Author: Robert Hyatt
Date: 20:05:24 07/06/01
Go up one level in this thread
On July 06, 2001 at 14:37:14, Artem Pyatakov wrote: >I would like to save some memory in things like the history table, but I am >using the 0x88 board representation, and I would like to sometimes convert these >coordinates to a normal 8x8 board (so I could have a 64x64 array instead of >128x128 array)... What is the fastest way to do this conversion? > >Thanks Two solutions come to mind. First, an array of 128 entries, where the contents of each element is its corresponding element in the 8x8 array. the second is a bit more computation, but eliminates the array. I will give you some simple code that can be written a bit faster. But it is easier to understand as I give it: file=x88square&7; // this grabs the 3 bits for file number rank=(x88square>>1)&0x38; // this grabs 3 bits for rank, but shifted // right one bit so that it ends up in the // right place. square8x8=rank+file; // combine into a 6 bit number. you will // end up with values such that 0 <= N <= 63 Bob
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.