Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Mobility in chess engines

119 views
Skip to first unread message

Jean-François GAZET

unread,
Nov 5, 2003, 9:45:56 AM11/5/03
to
Hi,

i'm wondering if counting attacked squares is a good thing.
For example, if :
white has 15 moves and
black has 22 moves,
then, is it correct to add
15 points to white and
22 points to black
into the evaluation function ? Is it what some engines do ?

If so, this takes a long time to calculate as it is similar to gen moves,
but we return the move number.

Could you help me to go to the good way ? How to add mobility into the eval
function ?

Thanks.
Regards.


Russell Reagan

unread,
Nov 5, 2003, 1:22:10 PM11/5/03
to
"Jean-François GAZET" <jf.g...@eltitec.com> wrote

> i'm wondering if counting attacked squares is a good thing.

Some programs do it and some don't. Some even do it for only a few pieces.
For instance, mobility for bishops can help to keep your bishops from
getting blocked by pawns. I have heard that it really isn't that big of an
improvement for most people, and like I said, some don't even use it at all
and have very strong programs.


> If so, this takes a long time to calculate as it is similar to gen moves,
> but we return the move number.

With bitboards you can get pseudo-mobility almost for free. Crafty has some
code that doest his. Basically it works the same way that rotated bitboards
work, only instead of getting back an attack bitboard, you get back a number
that is the number of attacked squares.


Jean-François GAZET

unread,
Nov 5, 2003, 2:57:26 PM11/5/03
to

Thanks for your answer.
Is it the only way to count attacked squares ? as i'm not used to bitboards
and my engine don't use it.


Harald Luessen

unread,
Nov 5, 2003, 4:53:02 PM11/5/03
to

One way to do this is:

You have to generate _all_ moves before you try the
moves in a loop and go one ply deeper in the search.
Your move generator must update a mobility value
that depends on moves, squares and pieces. Or your
sort function does this, if it scans all the moves.
If you are in the full search at ply N and at least
at ply 2, then you can use the mobility value:
mobility_value = mobility[ply-2] - mobility[ply-1]
If the effects of this is too big then always divide
it by 8 or 16 or whatever you like.

You can use an array to calculate the mobility of
every piece dependent on the to-square.

mobility[ply] = 0
for all moves of any piece to any square
mobility[ply] += mobility_table[piece][square]

With this method you can weight the rook mobility as
always 2, the bishop mobility as 1 at the edges of the
board and 3 for center control and so on. There is
room for improvement.

In the quiescence search you can only use the last
full search entries because you don't see most of
the possible moves. Just copy the mobility.
mobility[ply] = mobility[ply - 2]

The problem is, you only use outdated values that
are not really true in the current position.

Harald

Jean-François GAZET

unread,
Nov 6, 2003, 5:25:36 PM11/6/03
to
> >i'm wondering if counting attacked squares is a good thing.
> >For example, if :
> >white has 15 moves and
> >black has 22 moves,
> >then, is it correct to add
> >15 points to white and
> >22 points to black
> >into the evaluation function ? Is it what some engines do ?
> >
> >If so, this takes a long time to calculate as it is similar to gen moves,
> >but we return the move number.
> >
> >Could you help me to go to the good way ? How to add mobility into the
eval
> >function ?
>
> One way to do this is:
> [...]
> > Harald

Thanks for your anwser, i'll think about it.


0 new messages