Author: Daniel Clausen
Date: 05:26:18 05/30/02
Go up one level in this thread
Hi Sune! :) On May 29, 2002 at 19:22:02, Sune Fischer wrote: >On May 29, 2002 at 10:11:01, Daniel Clausen wrote: > >>On May 28, 2002 at 14:13:05, Uri Blass wrote: >> >>[snip] >> >>>The problem from my point of view is not speed but knowing that the >>>unexpected happened. >>> >>>If the program continues to play then I will not know that the program >>>extended too much. >> >>If I want to know whether my engine extends too much or not, I will do >>exactly that - add a test for this. I won't use an array which will be >>overwritten and crash the program later maybe. > >>Sargon > >What if you don't have a test position handy? Then I try to create one? Or I ask in CCC for one. :) I tend to (try to) solve things when I think they are an applicatoric problem. (note that a program bug (array overrun) is not the same as an applicator problem (extend too much) - at least not in my dictionary. YMMV) I'm a bit confused.. do you really think it's a good thing to not check array overruns so that an engine does something undefined (which can be a crash, or just an illegal move, or formatting your hard drive) in case you extend too much and hope that maybe after hours of debugging you find the reason? Cool. :) >Will you leave the engine running with this debug check forever, just in case? Most likely, yes, since I'm not a speed junkie. (no pun intended! :) Chess is an exponential game (I mean the search tree) and I couldn't care less about a speed-factor of 1/2500. (your number I think :) Afterall this translates to something like 0.0x ELO. I try to make my engine stronger, but the primary goal is that it plays correct moves. ;) >If in your code you have A[B[i]], do you also check that 0<=B[i]<=max, or do >you *trust* your previous calculation of the data in B[i]? (1) I _always_ check input from 'external sources'. E.g. if 'i' could be a user input, I'd _always_ make a range check before B[i]. Always, always, always. Yes, also in the release code. (2) Before evaluating A[B[i]] I might add an assert which makes a range check for B[i] first. This helps me catching engine-internal bugs pretty easy. Once I have a good feeling and make a release, I _maybe_ compile with -DNDEBUG and the assert is gone. >How much safety net do you need, how much speed will you sacrifice to protect >against the impossible happening? As I said before, I'm not a speed junkie. :) I always prefer correct code before fast code. And guess what? Quite often these two are not mutual exclusive. While you spend time in the debugger hunting an array overrun, I happily make my move-sort better. ;) Sargon PS. Another thing: I've noticed that some people judge the usefulness of a check (not the chess term :p) by the number of times it fails. (a comon mistake :) I hope that these people don't work for an airplane company. ;)
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.