X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=gnushogi%2Feval.c;h=97b748e8218b98198d8a61b0ba3e48e6e828012a;hb=9621a4712b7df55d6fe4fff44789c8e4c7476013;hp=569b99766325fb512b48f82a9bd25ce7445c0856;hpb=66ff943ab8bb2b33f5627ec27f1d8d85a29ec251;p=gnushogi.git diff --git a/gnushogi/eval.c b/gnushogi/eval.c index 569b997..97b748e 100644 --- a/gnushogi/eval.c +++ b/gnushogi/eval.c @@ -4,6 +4,7 @@ * ---------------------------------------------------------------------- * Copyright (c) 1993, 1994, 1995 Matthias Mutz * Copyright (c) 1999 Michael Vanier and the Free Software Foundation + * Copyright (c) 2008, 2013, 2014 Yann Dirson and the Free Software Foundation * * GNU SHOGI is based on GNU CHESS * @@ -32,9 +33,6 @@ #include "gnushogi.h" #include "pattern.h" -extern void -ShowStage(void); - /* Hash table for preventing multiple scoring of the same position */ int EADD = 0; /* number of writes to the cache table */ @@ -341,6 +339,7 @@ on_csquare(short side, short piece, short square) } +#ifndef MINISHOGI inline static short on_column(short side, short piece, short c) { @@ -387,13 +386,12 @@ on_right_side(short side, short piece) return false; } +#endif short pscore[2]; /* piece score for each side */ - - /* * Fill array attack[side][] with info about attacks to a square. Bits * 16-31 are set if the piece (king .. pawn) attacks the square. Bits 0-15 @@ -828,7 +826,10 @@ BRLscan(short sq, short *mob) #endif short s, mobx; - short u, xu, pin, ptyp, csq = column(sq); + short u, xu, pin, ptyp; +#ifndef MINISHOGI + short csq = column(sq); +#endif short piece, upiece, xupiece, rvalue, ds; small_short *Kd = Kdist[c2]; @@ -1262,13 +1263,12 @@ trapped(short sq) static int -AttackedPieceValue(short sq, short side) +AttackedPieceValue(short sq) { - short s, ds; + short s; s = 0; - ds = -fv1[HUNGP] * 2; hung[c1]++; shung[sq]++; @@ -1337,7 +1337,9 @@ PawnValue(short sq, short side) { short s = 0; short ds; +#ifndef MINISHOGI short ccol = ccolumn(c1, sq); +#endif PromotionZoneDistanceValue(sq, 3); @@ -1426,7 +1428,7 @@ PawnValue(short sq, short side) */ static inline int -LanceValue(short sq, short side) +LanceValue(short sq) { short s = 0, ds, ad; @@ -1456,7 +1458,7 @@ LanceValue(short sq, short side) */ static inline int -KnightValue(short sq, short side) +KnightValue(short sq) { short s = 0, ad; short ds, checked_trapped = false; @@ -1493,7 +1495,7 @@ KnightValue(short sq, short side) */ static inline int -SilverValue(short sq, short side) +SilverValue(short sq) { short s= 0, ds, ad; @@ -1541,7 +1543,7 @@ SilverValue(short sq, short side) */ static inline int -GoldValue(short sq, short side) +GoldValue(short sq) { short s = 0, ds, ad; @@ -1583,7 +1585,7 @@ GoldValue(short sq, short side) */ static inline int -BishopValue(short sq, short side) +BishopValue(short sq) { short s = 0, ds, ad; @@ -1718,7 +1720,7 @@ RookValue(short sq, short side) */ static inline int -PPawnValue(short sq, short side) +PPawnValue(short sq) { short s = 0, ds, ad; @@ -1735,7 +1737,7 @@ PPawnValue(short sq, short side) */ static inline int -PLanceValue(short sq, short side) +PLanceValue(short sq) { short s = 0, ds, ad; @@ -1751,7 +1753,7 @@ PLanceValue(short sq, short side) */ static inline int -PKnightValue(short sq, short side) +PKnightValue(short sq) { short s = 0, ds, ad; @@ -1768,7 +1770,7 @@ PKnightValue(short sq, short side) */ static inline int -PSilverValue(short sq, short side) +PSilverValue(short sq) { short s = 0, ds, ad; @@ -1784,7 +1786,7 @@ PSilverValue(short sq, short side) */ static inline int -PBishopValue(short sq, short side) +PBishopValue(short sq) { short s = 0, ds, ad; @@ -1800,7 +1802,7 @@ PBishopValue(short sq, short side) */ static inline int -PRookValue(short sq, short side) +PRookValue(short sq) { short s = 0, ds, ad; @@ -1818,7 +1820,7 @@ PRookValue(short sq, short side) */ static inline int -KingValue(short sq, short side) +KingValue(short sq) { short s = 0, ds; @@ -1904,7 +1906,7 @@ PieceValue(short sq, short side) if (a1 == 0) { /* undefended piece */ - s += AttackedPieceValue(sq, side); + s += AttackedPieceValue(sq); } else { @@ -1915,7 +1917,7 @@ PieceValue(short sq, short side) if (attack_value < piece_value) { /* attacked by a weaker piece */ - s += AttackedPieceValue(sq, side) / 2; + s += AttackedPieceValue(sq) / 2; } else if (abs(attack_value - piece_value) < 10) { @@ -1982,24 +1984,24 @@ PieceValue(short sq, short side) #ifndef MINISHOGI case lance: - s += LanceValue(sq, side); + s += LanceValue(sq); break; case knight: - s += KnightValue(sq, side); + s += KnightValue(sq); break; #endif case silver: - s += SilverValue(sq, side); + s += SilverValue(sq); break; case gold: - s += GoldValue(sq, side); + s += GoldValue(sq); break; case bishop: - s += BishopValue(sq, side); + s += BishopValue(sq); break; case rook: @@ -2007,33 +2009,33 @@ PieceValue(short sq, short side) break; case king: - s += KingValue(sq, side); + s += KingValue(sq); break; case ppawn: - s += PPawnValue(sq, side); + s += PPawnValue(sq); break; #ifndef MINISHOGI case plance: - s += PLanceValue(sq, side); + s += PLanceValue(sq); break; case pknight: - s += PKnightValue(sq, side); + s += PKnightValue(sq); break; #endif case psilver: - s += PSilverValue(sq, side); + s += PSilverValue(sq); break; case pbishop: - s += PBishopValue(sq, side); + s += PBishopValue(sq); break; case prook: - s += PRookValue(sq, side); + s += PRookValue(sq); break; } @@ -2138,7 +2140,7 @@ UpdatePatterns(short side, short GameCnt) } if (flag.post) - ShowPatternCount(side, n); + dsp->ShowPatternCount(side, n); if (os != END_OF_SEQUENCES) update_advance_bonus(side, os); @@ -2530,8 +2532,8 @@ DetermineGameType(short side_to_move) } else { - ShowPatternCount(black, -1); - ShowPatternCount(white, -1); + dsp->ShowPatternCount(black, -1); + dsp->ShowPatternCount(white, -1); } } @@ -2708,7 +2710,7 @@ DetermineStage(short side) stage = 0; if (flag.post) - ShowStage(); + dsp->ShowStage(); /* Determine stage dependant weights */ @@ -2744,6 +2746,7 @@ DetermineStage(short side) void UpdateWeights(short stage) { + /* FIXME: this was emptied between 1.1p02 ans 1.2p03, do we keep it ? */ }