Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: How do you debug?

Author: Bruce Moreland

Date: 11:58:39 06/05/00

Go up one level in this thread


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.

If I have a more serious bug I sometimes have to dump a tree, which is a debug
option.

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.

Being extremely careful all the time is also helpful, and is a good programming
practice.

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.