Author: Tord Romstad
Date: 01:56:43 12/23/02
Go up one level in this thread
On December 19, 2002 at 18:49:56, Dann Corbit wrote: >On December 19, 2002 at 18:47:22, Joshua Haglund wrote: > >>Anyone know of a good site(s) for the programming of a (legal) move generator? > >You'll find a lot more help looking for a pseudo-legal move generator. I don't >think anyone makes a strictly legal move generator (maybe Uri does...) I do. The evaluation function is called at all nodes, before the move generator is called. Among other things, the evaluation function initializes an array containing all the pinned pieces: int pinned[128]; /* I use 0x88, hence the board has 128 squares. */ I pinned[sq] is zero, this means that the square sq is empty or that the piece on the square is not pinned. If pinned[sq] is 16, this means that the piece is vertically pinned and can only move along the file it occupies. A value of 15 means that the piece can only move in the h1-a8 direction, and so on. Using this array, it is easy to generate legal moves. For pinned pieces, I only generate moves along the direction indicated by the pinned[] array. For all other pieces, almost all pseudo-legal moves are legal. The only exceptions are king moves and en passent captures. For these moves, I do a make_move() followed by an in_check() and an unmake_move(). Of course initializing the pinned[] array consumes some time, but it is neglible compared to the rest of my evaluation function. Tord
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.