Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Can somebody write a debugging function for the following task or ma

Author: Robert Hyatt

Date: 09:27:02 08/14/03

Go up one level in this thread


On August 14, 2003 at 05:29:35, Uri Blass wrote:

>There is already a free program that does it?
>
>The debugging function that I think about is writing the content of varaibles to
>files
>
>I should have 2 functions:


One thing you should do is write a "Validate()" procedure as I did for
Crafty.  This procedure tests _all_ data structures.  IE it makes sure
that the hash signature is correct for the current board position, that
the pieces are on the board correctly, that no two pieces occupy the same
square (possible with bitboards if you have a bug) and so forth.  I compile
this in/out with the -DDEBUG compiler macro definition.  I call it after
every MakeMove()/UnmakeMove() call, and at a few other places as well.  If
something goes haywire, I add -DDEBUG and run the test again, this will
typically show me exactly where the problem occurs (I pass Validate() a
string that is unique for each calling location) and it shows me what was
corrupted.

It's saved a ton of time over the years.





>
>void Writearrays(int nodes)
>{
>//this function writes the arrays
>int queens[9][2];
>int rooks[10][2];
>int bishops[10][2];
>int knights[10][2];
>int pawns[8][2];
>to a file when the name of the file begins with movei and end with the number
>nodes for example the file may have the name movei57.d when it gets nodes=57 and
>the name movei898.d when it gets nodes=898
>}
>
>int comparearray(int nodes)
>{
>/*this function looks at the relevant file (for example movei898.d if nodes=898)
>and compare the content of that file to the numbers that are in the array
>This function return 0 if there is no problem and returns 1 if the file does not
>match the varaible(in case of returning 1 the function also writes the name of
>the array that is different and the exact places that it is different
>*/
>}
>
>I will try to think about the problem by myself but my experience with files is
>limited so it is not a trivial task for me and I need to look at previous work
>that I did with files to refresh my memory(I imagine that there are good
>programmers that can solve a problem like this in a few minutes)
>
>Uri



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.