Author: Peter Fendrich
Date: 08:52:25 12/25/03
Go up one level in this thread
On December 25, 2003 at 10:49:05, Tord Romstad wrote: >On December 25, 2003 at 02:33:00, Russell Reagan wrote: > >>This is a question mainly directed at chess programmers. Why do some of you >>store a chess move as a structure, and others of you store it as a packed int? >>Crafty stores them as a packed int, while many others use a struct. >> >>An example of the packed int approach is: >> >>typedef int Move; >>Move m = from_square | (to_square << 6) | (move_flags << 12); >> >>Pros: Handling of a move as a whole entity is fast (i.e. copying, sorting, etc.) >>Cons: Accessing fields of a move and packing the move requires some overhead >> >>An example of the struct approach is: >> >>struct Move >>{ >> int from; >> int to; >> unsigned flags; >>}; >> >>Move m; >>m.from = from_square; >>m.to = to_square; >>m.flags = move_flags; >> >>Pros: Accessing fields and initializing the move requires less overhead >>Cons: Moving these things around will be less efficient (copying, etc.) > >Another con is that you will probably still have to use the packed int >representation when storing and retrieving moves from transposition table >entries. If you use the struct approach, you will have to write small >functions to convert moves between the two formats, and this obviously >implies some overhead. > >I currently use the struct approach, but I have switched to the packed >int approach in the new engine I am writing. The main reason is just >that it seems slightly more convenient and less messy. I doubt that >it will have any noticable effect on performance. > >Tord I compare and move around moves all over the place and therefore like the int format better. BTW the new program that you're mentioning is that the palm version or have you started a complete replacement of Gothmog? I'm thinking about starting a replacement to Terra with a 180 degree different approach. Combined bitboard and 16+16 board, more knowledge intensive, another search approach and possibly some learning abilities. It's only in the design phase sofar... /Peter
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.