Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Move Generator

Author: Gerd Isenberg

Date: 03:40:45 12/20/02

Go up one level in this thread


On December 19, 2002 at 19:53:46, Andreas Herrmann wrote:

>On December 19, 2002 at 19:21:04, Uri Blass wrote:
>
>>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 did it and chest also did it and I remember that other programmers also did
>>it(Miguel started with legal move generator and I remember that peter makanzi
>>also does it(or at least did it in the past)).
>>
>>pseudo legal move generator is the easy way but I do not think that it is better
>>and the fact that chest is the best mate solver suggest that legal move
>>generator may be better.
>>
>>Uri
>
>Hi Uri,
>
>but a pseudo legal move generator is faster. You have to check if the king is in
>check only if you must evaluate a position.
>What is the advantage of a slower legal move generator?
>
>Andreas

Hi Andreas,

Not sure about that. Detecting pinned pieces is a rather fast and loopless  task
with bitboards, specially with mmx-fill routines (unrolled for each of eight
directions). In the same run one could also detect possible covered checkers fo
the opposite side.

eg. for one direction:

// rooks or queens
if ( enemyRookMover & allRaysFromSquare[ownKingSquare])
{ // scan four staight directions
  dirBB    = getLeftAttacks(ownKingBB) & getRightAttacks(enemyRookMover);
  pinned  |= dirBB & ownPieces;
  covered |= dirBB & enemyPieces;
  ...
}

Of course it's a bit overhead but the gained information is also usefull for
other things, as Uri already pointed out.

If there are pinned pieces, one safes making/unmaking invalid moves and there is
no need (may be only for debug purposes) to look whether a king may be captured.

Gerd



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.