Author: Tord Romstad
Date: 08:22:24 08/20/04
Go up one level in this thread
On August 20, 2004 at 10:59:16, Robert Hyatt wrote: >On August 20, 2004 at 05:05:19, Tord Romstad wrote: > >>On August 20, 2004 at 00:37:26, Eric Oldre wrote: >> >>>On August 19, 2004 at 18:46:32, Robert Hyatt wrote: >>>> >>>> >>>>Has to do with passed pawns and no pieces on the board. If you form a square >>>>with one side going from the pawn to its promotion square, if the king is inside >>>>that square, the pawn can't run and promote. If the king is outside that square >>>>then the pawn promotes and wins. Simple idea with a few wrinkles to deal with. >>> >>>Thanks Robert, >>>that is actuall something I know i've read about at some point on this board. >>>and it's something that i hope i'll get to at some point. >>> >>>wouldn't you need to have 2 different bit boards? depending on who's turn it is >>>to move? >> >>You don't need even a single bitboard. Just compare the distance of the >>passed pawn to the promotion square to the distance of the defending king >>to the promotion square. Subtract 1 from the defending king's distance >>if it is the defender's turn to move. >> >>Tord >> > >Bitboards don't need any subtraction, any correction for side to move, nor even >the exact king square. It looks something like this: > >if (white_pawn_race[square of white pawn] & BlackKing) pawn can't run. The reason you don't need any subtraction is that you use separate white_pawn_race and black_pawn_race bitboards depending on the side to move. If you double the array sizes, you can of course eliminate the correction for side to move. This is completely unrelated to whether you use bitboards or not. Without bitboards, the code looks roughly like this: if(pawn_race[(square of white pawn)-(square of black pawn)]) pawn can't run No big difference compared to the bitboard version, IMHO. I doubt that the subtraction is much more expensive than the binary 'and' in the bitboard version. For simple stuff like this, it simply doesn't matter much whether you use bitboards or not. I personally prefer not to use bitboards for this, because I need less memory (a single 256-byte array is all I need). Just a matter of taste, I suppose. Tord
This page took 0.01 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.