X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=gnushogi%2Feval.c;h=8e7bd06540a1ece393d3c0376f190c92c1cf87e8;hb=89b2fc0e2d267a6bea4697ee655dc32ef5afb087;hp=15509e2bf194eaf8ba21a494c633fba1b5f595a7;hpb=1aca00e04580e7b3effefa535edb469876ecce74;p=gnushogi.git diff --git a/gnushogi/eval.c b/gnushogi/eval.c index 15509e2..8e7bd06 100644 --- a/gnushogi/eval.c +++ b/gnushogi/eval.c @@ -2,20 +2,17 @@ * FILE: eval.c * * ---------------------------------------------------------------------- - * Copyright (c) 1993, 1994, 1995 Matthias Mutz - * Copyright (c) 1999 Michael Vanier and the Free Software Foundation * - * GNU SHOGI is based on GNU CHESS + * Copyright (c) 2012 Free Software Foundation * - * Copyright (c) 1988, 1989, 1990 John Stanback - * Copyright (c) 1992 Free Software Foundation + * GNU SHOGI is based on GNU CHESS * * This file is part of GNU SHOGI. * * GNU Shogi is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 1, or (at your option) any - * later version. + * Free Software Foundation; either version 3 of the License, + * or (at your option) any later version. * * GNU Shogi is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or @@ -23,8 +20,8 @@ * for more details. * * You should have received a copy of the GNU General Public License along - * with GNU Shogi; see the file COPYING. If not, write to the Free - * Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * with GNU Shogi; see the file COPYING. If not, see + * . * ---------------------------------------------------------------------- * */ @@ -274,7 +271,7 @@ static small_short *fv1; static long *atk1, *atk2; static long a1, a2; -#define csquare(side, sq) ((side == black) ? sq : (NO_SQUARES_1 - sq)) +#define csquare(side, sq) ((side == black) ? sq : (NO_SQUARES - 1 - sq)) #define crow(side, sq) row(csquare(side, sq)) #define ccolumn(side, sq) column(csquare(side, sq)) @@ -294,7 +291,7 @@ on_column(short side, short piece, short c) { short sq; - for (sq = c; sq < NO_SQUARES; sq += 9) + for (sq = c; sq < NO_SQUARES; sq += NO_COLS) { if (on_csquare(side, piece, sq)) return true; @@ -1005,7 +1002,7 @@ BRLscan(short sq, short *mob) { \ if (color[u] != c2) \ { \ - if ((atk1[u] == 0) || ((atk2[u] & CNT_MASK) > 1)) \ + if ((atk1[u] == 0) || ((atk2[u] & CNT_MASK) != 0)) \ { \ ++cnt; \ } \ @@ -1280,7 +1277,7 @@ PawnValue(short sq, short side) PromotionZoneDistanceValue(sq, 3); /* pawn mobility */ - if (color[(c1 == black) ? (sq + 9) : (sq - 9)] == neutral) + if (color[(c1 == black) ? (sq + NO_COLS) : (sq - NO_COLS)] == neutral) { s += (ds = MBLTY[pawn]); } @@ -1294,7 +1291,8 @@ PawnValue(short sq, short side) { if (crow(c1, sq) == 2) /* pawn on 3d rank */ { - if (board[(c1 == black) ? (sq + 27) : (sq - 27)] == pawn) + if (board[(c1 == black) ? + (sq + 3*NO_COLS) : (sq - 3*NO_COLS)] == pawn) { /* opposing pawn has been moved (even column == (sq & 1)) */