Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: I don't use illegal moves EVER

Author: Daniel Clausen

Date: 12:06:09 11/25/99

Go up one level in this thread


Hi

On November 25, 1999 at 08:42:29, leonid wrote:
>
>I am curious about your InCheck-MovesGenerator. Do you use it for producing all
>the moves beside the moves of the King? And if you do so, how you start your
>procedure that recognize the legality of the moves? Do you make this by finding
>at the beginning of given ply position of the King? And do you make work this
>generator before even finding one single move? I am asking this to recognize my
>part of the logic that correspond to your generator.

The inCheck-MoveGenerator will (once I have time to finish it..) produce all
legal
moves, so yes, it also produces king moves. The logic is approx as follows:

if(inCheck(sideToMove))
{
   if(numberOfAttackers>1)
   {
      // Produce only king evasion moves.
   }
   else
   {
      // 1. Produce king evasion moves.
      // 2. Produce moves which capture moves which capture the
      //     attacker.
      // 3. If the attacker is not a knight, produce also moves where the
      //     target square is between king and attacker. (and adding Mr Hyatts
      //     pinning-check)
   }
}
else
{
   // Call normal move-generator.
}

I hope I didn't forget something, but I can't check the code atm.
Btw: Sorry for the bad formatting of my last 2-3 postings - I just
switched to a new browser. :)

Kind regards,
 -sargon



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.