pkgsrc/games/crafty/patches/patch-ab
jlam 709fc4ab28 Update games/crafty to 18.15. Changes from version 18.13 include:
18.14   Minor bug in ResignOrDraw() code caused Crafty to not offer draws
        although it would accept them when appropriate.  Rook vs Minor
        is now evaluated as "neither side can win" an oversight in the
        EvaluateWinner() code.  minor bug in ResignOrDraw() would fail to
        offer draws due to the +0.01/-0.01 draw scores returned by the
        EGTB probe code.

18.15   change in endgame draw recognition to handle the case where one
        side appears to be in a lost ending but is stalemated.  the code
        now evaluates such positions as "DrawScore()" instead.  the code
        to accept/decline draws has been modified.  when a draw offer is
        received, a global variable "draw_offer_pending" is set to 1.
        when the search for a move for crafty terminates, crafty then
        uses this value to decide whether to accept or decline the draw.
        this means that the accept/decline won't happen until _after_ the
        search has a chance to see if something good is happening that
        should cause the draw to be declined, closing a timing hole that
        used to exist that let a few "suspects" get away with draws that
        should not have happened (ie crafty has - scores for a long time,
        the opponent suddenly fails low and sees he is losing and offers
        a draw quickly.  Crafty would accept before doing a search and
        noticing that it was suddenly winning.)  minor evaluation change
        to notice that K+B+right RP vs K+B is not necessarily won if the
        weaker side has a bishop of the right color.
2002-09-11 10:52:09 +00:00

67 lines
1.5 KiB
Text

$NetBSD: patch-ab,v 1.4 2002/09/11 10:52:10 jlam Exp $
--- boolean.c.orig Thu May 23 10:02:28 2002
+++ boolean.c
@@ -61,23 +61,49 @@ int PopCnt(register BITBOARD a) {
}
int FirstOne(BITBOARD arg1) {
+ unsigned int i, j, k;
+
+ j = k = 0;
if (arg1>>48)
- return (first_one[arg1>>48]);
- if ((arg1>>32)&65535)
- return (first_one[(arg1>>32)&65535]+16);
- if ((arg1>>16)&65535)
- return (first_one[(arg1>>16)&65535]+32);
- return (first_one[arg1&65535]+48);
+ i = ((BITBOARD)(arg1>>48));
+ else if ((arg1>>32)&65535) {
+ i = ((arg1>>32)&65535);
+ j = 16;
+ } else if ((arg1>>16)&65535) {
+ i = (arg1>>16)&65535;
+ j = 32;
+ } else {
+ i = arg1&65535;
+ j = 48;
+ }
+ while (i >>= 1)
+ k++;
+ k = 16 - k;
+ return (j + k - 1);
}
int LastOne(BITBOARD arg1) {
- if (arg1&65535)
- return (last_one[arg1&65535]+48);
- if ((arg1>>16)&65535)
- return (last_one[(arg1>>16)&65535]+32);
- if ((arg1>>32)&65535)
- return (last_one[(arg1>>32)&65535]+16);
- return (last_one[arg1>>48]);
+ unsigned int i,j,k;
+
+ j = k = 0;
+ if (arg1&65535) {
+ i = arg1&65535;
+ j = 48;
+ } else if ((arg1>>16)&65535) {
+ i = (arg1>>16)&65535;
+ j = 32;
+ } else if ((arg1>>32)&65535) {
+ i = (arg1>>32)&65535;
+ j = 16;
+ } else
+ i = arg1>>48;
+
+ while ((i & 0x1) == 0) {
+ i >>= 1;
+ k++;
+ }
+ k = 16 - k;
+ return j + k - 1;
}
#endif
#endif