Author: Dan Newman
Date: 01:17:15 01/25/00
Go up one level in this thread
On January 24, 2000 at 11:02:55, Alessandro Scotti wrote:
>On January 24, 2000 at 09:45:25, Steve Maughan wrote:
>
>>I realise that this is not a checkers forum but there may be someone here who
>>can help me.
>>
>>Does anyone know of the efficient methods of representing checkers moves.
>>Clearly bitboards can be used to represent the board, but the moves are > >trickier since there can be multiple captures.
>
>I don't know anything about checkers programming but the first thing that comes
>to mind would be to code the starting square (5 bits) and then the destination
>square using 5 or also 3 bits each since a piece can move to at most 8 squares
>from any point (4 non captures/4 captures). If the move is a capture then
>further captures require only 2 bits each because there are 4 possible
>destination squares (so you need a table jump[32][4] to get the actual square).
>A 32-bit integer then should provide enough space for a quite long capture
>sequence, even considering that some bits would be needed to encode the number
>of "jumps" or to put a sentinel. Of course that's just an idea and possibly
>wrong!
Actually, that works quite well, with hardly a bit wasted... In my program
I had something like this for a bit layout:
33222222222211111111110000000000
10987654321098765432109876543210
jjjjjjjjjjjjjjjjccccddfffffeksmm
m: move type bits (move, jump, king move, king jump)
s: side doing the move
k: captured a king bit
e: move already tried bit
f: from-square (I actually stored the to-square, but don't remember why)
d: direction of initial move or jump
c: jump count (up to 8 extra jumps)
j: jump directions (two bits each)
-Dan.
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.