Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Bitboard VS array board ,speed difference in movegen()

Author: Jay Scott

Date: 12:27:30 02/27/01

Go up one level in this thread


On February 25, 2001 at 05:39:55, TEERAPONG TOVIRAT wrote:
>Actually,I work on a checkers program.  A lot of people here said
>they are dissapointed with bitboard for chess program. Yes, chess
>has 64 squares but checkers has 32 squares.  At first, I think
>it must be perfectly matched with checkers .

I think so, too. Move generation reduces to a short sequence of
mask-shift-and operations, then simply look for 1 bits. The entire
board state fits into three 32-bit integers: red pieces, white pieces,
kings of either side; everything else of interest can be computed
with no more than a few logical operations. On a modern processor,
surely that will beat walking around in an array of bytes.

You might want to use this correspondence between bits and squares,
instead of the obvious one. You will need to use rotates instead of
shifts to find moves, but there are fewer cases so it should be faster.

--00--08--16--24
01--09--17--25--
--10--18--26--02
11--19--27--03--
--20--28--04--12
21--29--05--13--
--30--06--14--22
31--07--15--23--

I came up with this ordering, but it's fairly obvious
if you think about it, so I doubt it's new. It's exactly
analogous to a Hyattian rotated bitboard, after all, except
that you don't need to keep an unrotated version. :-)

  Jay



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.