Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: C or C++ for Chess Programming?

Author: Dan Newman

Date: 15:19:53 08/21/00

Go up one level in this thread


On August 21, 2000 at 12:53:28, Dann Corbit wrote:

>On August 20, 2000 at 06:54:22, Dan Newman wrote:
>[snip]
>>Hi,
>>
>>That's interesting.  It sounds like you have a sort of hybrid program, if
>>you have bitboards *and* separate pieces in piece lists.  Actually, I guess
>>I have pieces too (in a way) since I have a "board" array with byte sized
>>entries which store the piece type and color--much as Crafty has.  But I
>>don't have piece lists now that I use bitboards...  In fact that's the main
>>reason I like bitboards; I always found piece lists problematical :).
>>
>>I've always wondered where make()/unmake() ought to go in an object oriented
>>program.  I think I'd have a move class and that's where they'd go, but then
>>how do you give the move's member functions access to all the state data
>>that they need: 1) pass the board and so forth into make(), 2) have the
>>board (and other state) be static members of the move class, or 3) make the
>>board, etc., global?  Each choice seems to have its drawbacks.  1) makes
>>the code cost more cycles that it needs to, 2) begs the question as to how
>>other parts of the code are to get to the board, 3) seems to be contrary
>>to the OOP paradigm...  I think 1) is probably the best choice.  Just
>>pass a pointer to the state data into make().  I guess you end up having
>>to do something like this anyway if you want to have a parallel search...
>
>How's this for a weird idea:
>
>Use several different move generators within one program.  For any particular
>stage of the game or any particular board position, use the internal format
>which (according to heuristic measurements) will be fastest.

I've thought of doing things like this.  For instance, when the number of
pieces gets *very* low, it can be faster to generate captures by examining
attacker and victim coordinates to determine if the one can attack the
other and if so making sure it does attack and finally generating the move.
If there are, say, two white pieces and three black pieces, this requires
only 2 * 3 == 6 "can attack" tests to be done, which can be a lot cheaper
than scanning the board.  Another advantage of this scheme is that you can
generate captures directly into MVV/LVA order...

-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.