Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Crafty null move question

Author: Steffen Jakob

Date: 21:19:12 07/18/02

Go up one level in this thread


On July 18, 2002 at 17:48:50, Robert Hyatt wrote:

// ...

>>>>>>or in C-world code
>>>>>>#define getFile(s) ((s)&7)
>>>>>>#define getRank(s) ((s)>>3)
>>>>>>
>>>>>>Greetings,
>>>>>>Steffen.
>>>>>
>>>>>
>>>>>I already do this.  I have "Rank()" and "File()" macros that I use most
>>>>>everywhere already.  Ditto for "From()", "To()", "Piece()", "Captured()" to
>>>>>extract that field from the 21 bit compressed move format I use internally.
>>>>
>>>><nitpicking>
>>>>crafty> egrep '&7\)|>>3\)' *.[ch] | grep -v '#define' | wc --lines
>>>>     23
>>>></nitpicking>
>>>>
>>>>Best wishes,
>>>>Steffen.
>>>
>>>
>>>your egrep is NFG.  If you look, many of those are in init.c and in the
>>>chess.h file where the File() is actually defined using that pattern.  :)
>>
>>What's so special about init.c? I use my encapsulating code in class
>>constructors as well ;-) BTW: the definitions of the macros are excluded by the
>>2nd grep call with the -v option above.
>>
>>Greetings,
>>Steffen.
>
>Note your grep -v only works on #defines where it fits on one line.  Hint:  mine
>often go to 2=3=4 lines which breaks that.  Also, not all &7 has anything

No, I checked before I wrote the grep statement that this isnt the case for your
rank/file macros definitions.

to do
>with the file number.  For example my transposition age field is 3 bits and

Run my command without the piped "wc". I dont think that the age field is
involved. Actually I couldnt find something with "age" and "7" in your code.

I
>use the &7 to truncate the age... as in age = (age+1) & 7; which tricks your
>grep into thinking that I used that file mask again.  :)

>In any case, I have fixed all that are legitimate rank and file accesses to
>use the correct mask.

Cool :)

Please also note that my grep command doesnt find all occurences of the
"&7"-stuff (sometimes there is a space between & and 7).

E.g.:
output.c:    *text++=(From(move) & 7)+'a';
output.c:    *text++=(To(move) & 7)+'a';
output.c:  *text++=(From(move) & 7)+'a';
output.c:  *text++=(To(move) & 7)+'a';

I hope all this doesnt sound too nitpicking. :)

>By the way, another error is that I do have some >>32 operations which breaks
>your >>3 string match too.  :)

No, it doesnt because I wrote >>3\). Note the closing bracket! :-)

Best wishes,
Steffen.



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.