Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Detecting stalemate with a pseudo-legal movegenerator?

Author: Frederik Tack

Date: 02:48:14 11/12/05

Go up one level in this thread


On November 11, 2005 at 20:42:08, Uri Blass wrote:

>In this case you may try to improve the speed of your incheck function.
>Note that you need to use it only after making moves and not after generating
>the list of pseudo-legal moves.

My move generator actually doesn't produce a list of moves but a list of
successor positions, so generating moves is pretty much the same as making moves
for me. For legal move generation, the 'incheck' function is executed after the
generation of the successor position and if it discovers the king is in check,
the successor is discarded.

>
>knowing if the king is under threat is important and it is not expensive because
>you only need to check for every new move if it threats check based on the from
>square and the to square(for example you know that a2-a3 does not threat check
>if the opponent black king is at e8 and it is also easy to find that it is legal
>in case that the white king is at e1 because the only way it can be illegal is
>if the king is in check or a2 is pinned and checking that a2 is not pinned to e1
>is easy and I assume that you know that the king is not under threat when you
>generate a2-a3).

I don't know if the king is under threat when i use pseudo-legal moves. The
whole point of using pseudo-legal moves is that you don't do a detection of
check threats (except for castling moves). You just let the opponent capture the
king which results for me in a 30% performance increase. Your approach is
however interesting and i will definately have a look at it.

>
>Note that you should have a special function to generate moves when the king is
>under threat.
>Note that I have a legal move generator but I have other reasons for it and not
>speed and what I suggest can be done with pseudo move generator when you have
>legal move generator only when the king is under threat.
>

>Note also that
>I think that 30% performance is not very important at the weak level of most
>engines.
>The difference between Fruit2.1 and Fruit2.2 is clearly more than 30% speed
>improvement so my opinion is that as long as your program is weaker than
>fruit2.1 you should not care much about optimizations that can give you only 30%
>speed improvement.

I have to disagree on that one. It's better to take performance into account
from the beginning and make a good design for your program. If you only do it at
the end, you might find yourself unable to do the neccessary performance
improvements because your design doesn't allow it anymore.

tx for the reply and suggestions.

Fred



This page took 0.01 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.