From 4e43501cd68d5bea128c89a615d716512b48c08e Mon Sep 17 00:00:00 2001 From: Yann Dirson Date: Thu, 29 Sep 2011 00:12:07 +0200 Subject: [PATCH] Avoid looking at the game type to determine minishogi piece values. We don't know how to determine the game type anyway, and a previous patch disables its computation, but no need to compile dead code in this case. Another problem to look at is that "in_opening_stage" is surely badly tuned for MiniShogi, but the program seems to score better with current code that by telling there is opening stage. Flag FIXME's where applicable so some willing soul would know where to find things to improve for MiniShogi. --- gnushogi/eval.c | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-) diff --git a/gnushogi/eval.c b/gnushogi/eval.c index 391cdb8..b0ae6c1 100644 --- a/gnushogi/eval.c +++ b/gnushogi/eval.c @@ -1383,6 +1383,10 @@ PawnValue(short sq, short side) } } +#ifndef MINISHOGI +/* FIXME: calculations below are wrong for minishogi, all done for 9x9 + * board - and anyway we don't know the stage really :) + */ if ((GameType[c1] == STATIC_ROOK) && (sq == csquare(c1, 43))) { if ((atk2[csquare(c1, 52)] & CNT_MASK) < 2) @@ -1404,6 +1408,7 @@ PawnValue(short sq, short side) s += (ds = -2 * fv1[ATTACKED]); } } +#endif } return s; @@ -1497,6 +1502,10 @@ SilverValue(short sq, short side) if (in_opening_stage) { +#ifndef MINISHOGI +/* FIXME: calculations below are wrong for minishogi, all done for 9x9 + * board - and anyway we don't know the stage really :) + */ if (GameType[c1] == STATIC_ROOK) { if (csquare(c1, sq) == 12) @@ -1510,6 +1519,7 @@ SilverValue(short sq, short side) } } } +#endif } else { @@ -1540,6 +1550,10 @@ GoldValue(short sq, short side) if (in_opening_stage) { +#ifndef MINISHOGI +/* FIXME: calculations below are wrong for minishogi, all done for 9x9 + * board - and anyway we don't know the stage really :) + */ if ((GameType[c1] == STATIC_ROOK) && (GameType[c2] != STATIC_ROOK)) { if (Mvboard[csquare(c1, 3)]) @@ -1547,6 +1561,7 @@ GoldValue(short sq, short side) s += (ds = -2 * fv1[OPENWRONG]); } } +#endif } else { @@ -1569,6 +1584,10 @@ BishopValue(short sq, short side) if (in_opening_stage) { +#ifndef MINISHOGI +/* FIXME: calculations below are wrong for minishogi, all done for 9x9 + * board - and anyway we don't know the stage really :) + */ if (GameType[c1] == RANGING_ROOK) { /* Bishops diagonal should not be open */ @@ -1590,6 +1609,7 @@ BishopValue(short sq, short side) s += (ds = -fv1[OPENWRONG]); } } +#endif } else { @@ -1614,6 +1634,10 @@ RookValue(short sq, short side) if (in_opening_stage) { +#ifndef MINISHOGI +/* FIXME: calculations below are wrong for minishogi, all done for 9x9 + * board - and anyway we don't know the stage really :) + */ short WRONG = fv1[OPENWRONG], OPOK = WRONG / 3; if (GameType[c1] == STATIC_ROOK) @@ -1672,6 +1696,7 @@ RookValue(short sq, short side) } } } +#endif } else { @@ -1795,6 +1820,10 @@ KingValue(short sq, short side) if (fv1[KSFTY] != 0) s += KingScan(sq); +#ifndef MINISHOGI +/* FIXME: calculations below are wrong for minishogi, all done for 9x9 + * board - and anyway we don't know the stage really :) + */ if (in_opening_stage) { if ((GameType[c1] != UNKNOWN) && (ccolumn(c1, sq) == 4)) @@ -1810,6 +1839,7 @@ KingValue(short sq, short side) s += (ds = -fv1[OPENWRONG] / 2); } } +#endif /* CHECKME: is this correct? */ if ((ds = fv1[HOPN])) @@ -2544,6 +2574,7 @@ ExaminePosition(short side) +/* FIXME: calculations below are wrong for minishogi, all done for 9x9 */ void DetermineStage(short side) { -- 1.7.0.4