Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: debugging question

Author: Gerd Isenberg

Date: 13:36:19 08/13/03

Go up one level in this thread


On August 13, 2003 at 15:24:28, Uri Blass wrote:

>On August 13, 2003 at 14:50:24, Gerd Isenberg wrote:
>
>>On August 13, 2003 at 11:56:38, Uri Blass wrote:
>>
>>>There are cases when I make changes that are not supposed to change
>>>a single global varaible(the changes can be only for speed or only some
>>>preperation for another change because new function that I write may be used
>>>later in a different way).
>>>
>>>I need for debugging purposes a function that put all
>>>global varaibles to a file and a function that compares
>>>the content of this file with the content of another
>>>file that is supposed to be the same.
>>>
>>>Is there a simple way to do it or do I need for every global array that I have
>>>to write a loop and for every varaible to write a special command.
>>>
>>>I prefer if there is some general solution(otherwise everytime that I add
>>>a new global varaible or delete a global varaible I also need to change the
>>>function).
>>>
>>>Uri
>>
>>Hi Uri,
>>
>>one solution is to put all globals in one or more structs or classes.
>>Instead of many globals vars and arrays you declare only one or few "global"
>>singletons. Some replacement work - but then you may implement some persistance
>>layer, to read and write it with sizeof(struct) from or to some files.
>
>A lot of variable are big arrays and I do not see how can I avoid a loop.

if the arrays are inside some struct, fwrite, fread or similar block functions
with size of struct is fine. One call for each read/write.


>
>The problem is that I waste too much time on investigating difference that I
>believe that should not happen.
>
>In the last case I tested some change in my move generator that was not supposed
>to change the number of nodes that were generated.
>
>I simply changed the generator of king moves to have 2 functions (one for king
>captures and one for king moves that are not captures).
>
>The order of moves in my move generator can be important for the number of moves
>but in this case I think that it should be not important because captures of the
>king are always assumed to be good captures so they are later should be ordered
>the same even if I do not generate them in the same order.
>
>The problem is that when I analyzed the opening position for almost 30 minutes
>and I found a difference of 2 in the number of nodes.
>
>I wanted to know the reason.
>
>I found after a lot of effort a node that the search became different
>
>node number 213,298,603 and I think that I spend too much time about this
>comparisons(of course I did not check every node and I first told the computer
>to print the line every 1048576 nodes and compared the output and every time I
>divided the interval of the suspected node by 8 or 16 but it is better if I do
>it by a different way)
>
>Uri

I see. Is it deterministic?
Even on several computers or with switching optimizations off?

Gerd



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.