Author: Russell Reagan
Date: 10:21:53 10/08/03
Go up one level in this thread
On October 08, 2003 at 09:18:51, Sune Fischer wrote: >There is just one thing about the geometrical relations I don't understand. > >Suppose you do >dir = sq1-sq2+128 (in 0x88) > >then dir is going to be some multiply of the direction and not (usually) the >step size needed for the board scan in the direction of dir. dir in this case isn't very useful by itself. You only use it in a table lookup. In the table, you could basically add the same entries for multiples (ex. the entry for an offset of 8 would contain the same entry for an offset of 16, 24, 32, and so on). Or you could make use of the actual offset between two squares. Maybe that could be useful in a king and pawn endgame where you have a pawn on the other side of the board which your king can't save. >So if one needs a table lookup in any cas, what's the great advantage over the >smaller 64 sized board? If I understand correctly, I think you're talking about the method TSCP uses? This uses an extra table lookup (two lookups) to get the next square. You could use a lookup table that was [64][64], but that is both bigger (4KB at best) and slower (2D array vs. 1D array) than a 256 element array. Also, I don't think the main use of the sq1-sq2+128 lookup is to find the step size for scanning. The main benefit is to save a lot of work. For instance, if you are trying to determine if a piece on a square can attack another square, you can do a lookup for the offset of those squares, and if it's not possible for sq1 to attack sq2, then you're done. If not, you can scan the board for blockers. Same thing for determining if the last move could have left the king in check, and all kinds of things that are dependent upon square relationships. I would not use the sq1-sq2+128 table lookup for move generation, for instance. I would just have an array of offsets probably. See Gerbil move generator for an example.
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.