Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Given a position, is it check?

Author: Thomas Mayer

Date: 05:29:38 02/03/05

Go up one level in this thread


Hi Jose,

On February 03, 2005 at 05:01:08, Jose Cortes wrote:

>
> Hi, I have a little doubt about finding the best way to, given a position,
> verify if it is check, using whatever data estructure, bitboard, etc. There
> are a lot of ways to do it, most of them using loops, but what is the most
> efficient?Someone can help me?

well, of course there are several ways, like some have already mentioned.

The easiest one is of course when you have attacktables always at hand -> just
check them and you know the answer.
In Quark it only has ALWAYS the pawnattacktables at hand -> if so, and it has a
hit, it also knows that it's check. The newer version does it a bit different,
it knows already wether the move checks or not before it even does a makemove.
How that works ? Well, there are some tables in Quark for that. So when it moves
e.g. a bishop it can look if that bishop CAN check the position the king
occupies right now. Then it has just to go in the correct direction to check IF
it checks or if there is something in between. But that is not sufficent, it has
also to check if a piece behind the old position of the bishop may check -> this
is also done with the described table. That was hell of debugging, but it
works... :) (Problems are especially en passant captures... I decide also before
my make move wether the move is legal or not - so after an en passant it could
be illegal because the missing opponent pawn would produce a check -> BUT it is
legal anyway because the own pawn is now in between the checking line... What I
mess -> I had only one positon where Quark did crash, after several hours of
thinking and I had no idea what I am searching for... :)

Greets, Thomas



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.