Computer Chess Club Archives


Search

Terms

Messages

Subject: It seems to me more logical instead of firstone and lastone to use

Author: Uri Blass

Date: 04:35:32 01/26/03


other functions that give 63-firstone and 63-lastone.

I looked at the code of crafty to see crafty's implementation of firstone and I
find that firstone simply count the zeros behind the first 1.

It is logical by definition because we can say that we find the place of the
first one but chess programs do not need to find the place of the first 1 but to
find the meaning of the first 1.

suppose that 259 is a bitboard and we want to evaluate the squares that are
relevant for that bitboard

259=1+2+256=2^0+2^1+2^8

0 intuitivily is a1
1 is intuitively b1
8 is intuitivily a2 so we want to evaluate these squares.

in other words we want to get the numbers 0,1,8 from 259

if we use firstone(259) we get 55 because there are 55 0's before 259

55 is not one of these numbers and we need to do 63- in order to get the
relevant numbers when we use firstone.

it is more logical to do

antifirstone(259)=8 so we can avoid the 63-(antifirstone is not a good name but
I did not find a good name at this moment)

You can claim that I may define the bitboard in another way when 1 means h8 but
I see no logical reason to do it.

I wonder if there is a special reason that I do not understand to do Firstone in
the way that Bob does it.

The only reason that I can find to start with the last rank is the definition of
FEN that for some reason that I fail to understand starts from the last rank and
not from the first rank but even in FEN they do not start from the last file.

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.