Author: Ralf Elvsén
Date: 14:05:01 06/05/00
Go up one level in this thread
On June 05, 2000 at 14:58:39, Bruce Moreland wrote:
>On June 05, 2000 at 11:36:30, Ralf Elvsén wrote:
>
>>
>>Some time ago I wrote an "experimental" program in Java, just to learn the
>>basics. I have now started to port it to C but I am glad I wrote the first
>>version in Java since I find it much easier to quickly do what I want,
>>exception handling and threading is very easy etc.
>>
>>One thing I have in the Java version is a kind of debug mode. For instance,
>>if I look at the PV and think "why did it choose move X instead of move Y
>>at ply 6?" , I can enter this debug mode. Then for each ply I will be asked
>>which branch I want to examine. I step through the moves ply by ply and thus
>>chose which nodes I want to observe. There I can see how all the moves are
>>scored, how alpha and beta changes etc. I can also chose to follow the
>>search after nullmoves.
>>
>>Running a search in this mode is exactly as a normal search, except that I get
>>very precise information about what happens. I find this just as superior
>>compared to a looking at a PV, as the PV is superior to just looking at
>>the best move at the root. I found many search- and evaluation bugs
>>in this way. The downside is that the code tends to become kind of messy
>>(and a new class of bugs is introduced) and I am not looking forward
>>to do it in C. Before I once again start to implement this I
>>would like to hear if this is a common way to debug, or if you have an
>>even better method I sure would like to hear about it.
>>
>>Ralf
>
>I make minor incremental changes, and if I'm doing a performance change I can
>quickly see that there *is* a bug, since I have a means of knowing that the tree
>shape has changed, and once I know there is a bug I can usually just look at
>what I changed and find it.
Hmm, I'm not sure I understand this... If you change your evaluation you
will change the tree, right? So how do you tell correct changes from
buginduced ones? ...but I probably don't understand your approach.
>
>If I have a more serious bug I sometimes have to dump a tree, which is a debug
>option.
Which nodes does a tree dump contain information about, and
what kind of info? Sorry if I am asking about "secrets" :)
>
>I had considered writing a run-time debugger, but it seemed like it would be a
>lot of UI work.
>
>But I think that your approach is perfectly valid, although the "kind of messy"
>comment is frightening.
Well, most of the messiness is due to myself being impatient when I code,
I have a tendency to write big functions/methods instead of making
many small ones. I will try to be more careful. Hopefully I will just
get a lot of
if (debugMode)
call some function...
scattered in the normal code, now when I do it the second time.
>
>Being extremely careful all the time is also helpful, and is a good programming
>practice.
I know, I know... I wonder how many hours I have
spent trying to track down bugs because I didn't use 5 mins to
scrutinize the code I wrote :(
>
>bruce
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.