Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: In the generate_move function...

Author: Tom Kerrigan

Date: 02:58:54 12/18/99

Go up one level in this thread


Generating pseudolegal moves is always better than generating legal moves. With
alpha-beta pruning, it is likely that you don't have to search all the moves of
a position. If you only generate pseudolegal moves, then you only have to test
move legality for the moves you search, and not all of the moves.

If you don't have fancy logic to sort captures, then you should probably search
all of them first. Some might not be very good, but (again because of alpha-beta
pruning) you won't even have to search them in most positions, so it's not a big
performance hit.

The best easy way to order captures is MVV/LVA. That means capturing the Most
Valuable Victim with the Least Valuable Attacker. So let's say you have three
possible captures: NxR, BxQ, PxQ. With MVV/LVA, you search PxQ, then BxQ, then
NxR.

Another way you will hear people talk about is SEE, which stands for Static
Exchange Evaluator. This is a function that takes a square and finds all the
pieces that attack it and guesses at the outcome of an exchange. If a queen can
capture a pawn, but a pawn can take the queen immediately afterwards, a SEE will
tell you that's a bad capture. But if a queen can capture a pawn and nothing can
take the queen, the SEE will tell you it's a good capture.

So a SEE is obviously better for move ordering. But it isn't very easy to
implement and it makes move ordering MUCH slower, so many people still use
MVV/LVA.

-Tom

On December 18, 1999 at 01:39:30, TEERAPONG TOVIRAT wrote:

>Hi all,
>I notice that there are two methods in generating
>the piece moves.
>First is to generate pseudolegal moves from
>every pieces then check their legalities after
>making them.
>The second , more complicated code, only the
>legal moves are generated.
>In my opinion, the former method is good in the
>early phase of game because both kings are
>quite safe and far from attack so there should
>be only few illegal moves. But in the late middle
>game or endgame the kings are  more exposed
>and usually take part in the game. There may be
>a lot of illegal squares for the kings.
>Is there a conclusion on this topic ?(for array board)
>Another question.
>Is it a consensus that all captured moves should
>be considered  first ? I think  those stupid sacrifice
>moves or some piece exchanging moves are not
>good enough to be above in the list.
> Do you agree?
>
>Thank for any help,
>Teerapong



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.