Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Are there any programs that do NOT check for legality after the fact?

Author: Robert Hyatt

Date: 12:25:45 07/07/00

Go up one level in this thread


On July 07, 2000 at 12:25:10, KarinsDad wrote:

>Other than mine?
>
>One of the bugs having my program play itself on Winboad discovered was that the
>king would move out of check into a square that was not originally covered by
>check, but is now an illegal square due to the checking piece now attacking it.
>For example:
>
>[D]1Q4k1/6pp/8/8/8/8/8/6K1 b
>
>In this position, white just played Qb8+. Black then plays the illegal move Kh8
>since it determines which squares are not attacked by white using the
>PieceAttacks structure (which is just a set of bits indicating which squares are
>attacked by which piece in a given position).
>
>Now, I am adding code to avoid this problem, but without generating ALL moves
>ahead of time and checking for legality after illegal moves have been generated,
>does anyone else have a program which does this up front? And if so, is there a
>slick way of doing it (my method is kind of clumsy)?
>
>KarinsDad :)


With bitmaps this is easy to do...  just make sure you move the king in any
direction _but_ the direction the check comes from.  Then Kh8 would not be
generated at all...



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.