Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Quick bit extraction question

Author: Tord Romstad

Date: 06:52:08 07/20/04

Go up one level in this thread


On July 20, 2004 at 09:39:09, Stuart Cracraft wrote:

>On July 20, 2004 at 08:29:42, Tord Romstad wrote:
>>
>>Here are the #defines I use to extract data from moves:
>>
>>#define FROM(x) (((x)>>7)&127)
>>#define TO(x) ((x)&127)
>>#define PROMOTION(x) (((x)>>14)&7)
>>#define PIECE(x) (((x)>>17)&7)
>>#define CAPTURE(x) (((x)>>20)&7)
>>#define EP_FLAG (1<<23)
>>#define EP(x) ((x)&EP_FLAG)
>
>Does this work for you with both the set and the test?
>Sounds like your sets would replace & with | in the above, no?

Yes.  When generating moves, I use the << and | operators.  When extracting
information from moves, I use >> and &, like above.

The advantage of representing moves as ints is that they are easy to copy,
compare and move around.  The disadvantage is that there is a small cost
when you need information like the 'from' and 'to' squares.

Tord




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.