bug-gnu-chess
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Minor performance enhancement in the evaluation


From: Anil Mungal
Subject: Minor performance enhancement in the evaluation
Date: Tue, 28 Jan 2003 12:47:42 -0500

Hi guys,
I've sped up the evaluation a little with the following code...
perhaps you could consider adding it to the CVS tree.

In the function BishopTrapped() there is no need to calculate
the penalty if there are no bishops on the board.  A diff to
eval.c follows:

547,549d546
<    if (board.b[side][bishop] == NULLBITBOARD)
<       return (0);
<


In eval.c there are a few places that calculate bitwise or's of
the rings[] Bitboard.  These calculations are constant and can
be replaced with a single lookup, rather than oring (is that a word?)
multiple lookups.
Diffs to main.c, eval.c, init.c, and common.h follow:

common.h:
351d350
< extern BitBoard boxes[2];

main.c:
56d55
< BitBoard boxes[2];

init.c:
624,625c624
<    boxes[0] = ULL(0x00003C3C3C3C0000); /* rings[0] | rings[1] */
<    boxes[1] = ULL(0x007E7E7E7E7E7E00); /* rings[0] | rings[1] | rings[2] */

eval.c:
231c231
<                boxes[1]);
---
>                (rings[0]|rings[1]|rings[2]));
234c234
<                boxes[1]);
---
>                (rings[0]|rings[1]|rings[2]));
379c379
<   n = nbits (controlled & boxes[0]);
---
>   n = nbits (controlled & (rings[0]|rings[1]));


I've also added some connected passed pawn evaluation code to ScoreP,
but I haven't figured out if the eval is any better yet :)
Let me know if you're interested in seeing it.

Regards,
Anil





reply via email to

[Prev in Thread] Current Thread [Next in Thread]