Author: Uri Blass
Date: 07:43:39 06/29/03
Go up one level in this thread
On June 29, 2003 at 10:36:28, Uri Blass wrote:
>On June 29, 2003 at 10:05:36, Jens Kahlenberg wrote:
>
>>... my advice is to use the assert-macro to state boolean expression at
>>aproppriate positions in source (see header-file assert.h for details)
>>
>>On June 29, 2003 at 08:23:44, Uri Blass wrote:
>>
>>>I found that my latest version show different analysis when I give it the same
>>>position again.
>>>
>>>It is not supposed to happen because I did not implement positional learning and
>>>after setboard command it should forget everything.
>>>
>>>The most logical reason that I can think about it is if
>>>an important global varaible is changed.
>>
>>Perhaps variables are not reinitialized and an appropriate assert-macro might
>>help you ... e. g.: assert( GLOBAL == 42 );
>>
>>>
>>>My question is if there is a simple way to check the global varaibles or global
>>>arrays that have different values.
>>
>>Global arrays are a little bit trickier to assert. I have to think a while about
>>the problem. I fear, that you need some extra looping-code embraced by #ifndef
>>NDEBUG ... #endif (see below)
>>
>>>
>>>I can generate a copy for every global varaible and later compare the global
>>>varaibles with their copies that are not used but this is not a general solution
>>>because this means that I need to add more debugging code when I add more
>>>varaibles.
>>>
>>>Uri
>>
>>You're right ... that would mess up your code and you would have to clean it
>>later ... errorprone :-( In contrast assertions are turned off by compiler-flag:
>>-DNDEBUG and can reside in your code _forever_
>>
>>Best regards,
>>Jens
>
>Thanks
>
>I guess that I will have a special function checkvaraibles to check the
>varaibles and arrays(I can disable the function by compiler flag)
>
>In order to check an array I will have in checkvaraibles something like this for
>every array:
>
>
>for (i=-8;i<0;i++)
>if (info[i]!=-1)
>{
> printf("mistake in the board");
> printf(" %d ",i);
>}
>for (i=0;i<64;i++)
>if (info[i]!=22)
>{
> printf("mistake in the board");
> printf(" %d ",i);
>}
>for (i=64;i<72;i++)
>if (info[i]!=-1)
>{
> printf("mistake in the board");
> printf(" %d ",i);
>}
>
>
>Note that info[i] when i=-8 is not a mistake because I used the following
>definitions
>int PADDED_info[80];
>int * const info = PADDED_info+8;
>
>Uri
Note that I may use constant instead of 22(I already have constant that I use in
the program but there are cases when I forget about it and use the number)
22 means empty square.
-1 means square that is not in the board.
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.