Author: Dan Newman
Date: 17:14:59 08/06/01
Go up one level in this thread
On August 06, 2001 at 04:12:25, Adrian Smith wrote: >Hey all! > >I am having trouble working out how to represent moves (e2e4 etc).. >As my programming experience isn't much yet, i decided to go with the 64 byte >array as my board. Could anyone help me establish how to represent the moves in >that format? > >Thanks > > > - Adrian Smith I assume you're talking about internal representation. There are all sorts of ways of doing this. What I do is stuff the move information into 32-bit integers and then shift and mask to get it back out again, as needed. Bob does this in Crafty. Bruce Moreland's moves (as I understand it) are in the form of pointers back into arrays of data structures containing pre- generated stuff for fast make/undo. Probably the most straight forward is to use a struct for a move with separate elements for from-square, to-square, and so forth. Typically you need to have from-square coordinate, to-square coordinate, and promotion type in the move. All else can be deduced by looking at the board. You can of course put in things like captive type and moving piece type as well. I stuff in a move-type which I switch on in make() and undo(). Since I'm using C++ I hide all the shifts and masks and so forth in inline member functions of a move class. This allows me to try out different implementations of the move without having to make massive changes to the rest of the code. -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.