Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Fruit 1.0 UCI (with source code) now available

Author: Uri Blass

Date: 06:13:50 03/18/04

Go up one level in this thread


On March 18, 2004 at 08:55:46, Fabien Letouzey wrote:

>On March 18, 2004 at 07:54:57, Uri Blass wrote:
>
>>I use only C file in movei and not C++ but it did not help me to make me easy to
>>understand the code.
>
>It does not matter if you use C or C++, just pick the one that makes things
>easier for you.
>
>>I will probably try to understand it later(I admit that I did not spend more
>>than an hour on trying to understand your code) because I decided that other
>>things like getting rid of my magic number that is going have bigger priority.
>
>Note that I am not saying "please read my code and learn a lot".
>I'm just not going to prevent people from trying.
>If you believe this can help you, please do so.
>
>What is your magic number? :)

I see that I forgot s in my post
magic numbers was the right expression and not magic number and I still have
many.

For example I have in my code bits(u)
#define bits(u) (((u)>>24)&255)

originally bits(u) was a char but I decided to change my move to integer so
today it is defined in that way

I have bits(u)&1 for captures bits(u)&2 for castling,bits(u)&4 for enpassant
captures bits(u)&16 for pawns move bits(u)&8 for pawn move twice and I often use
specific numbers of bits(u)

I decided that it is better to have varaibles and I already added

#define enpassant(u) ((u)&(1<<26))
#define conversion(u) ((u)&(17<<24))
#define firstpawn(u) ((u)&(1<<27))
#define promotion(u) ((u)&(1<<29))
#define queenpromotion(u) ((u)&(1<<18))
#define castle(u) ((u)&(1<<25))


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.