summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--[-rwxr-xr-x]src/bitboard.c0
-rw-r--r--[-rwxr-xr-x]src/board.c0
-rw-r--r--[-rwxr-xr-x]src/book.c0
-rw-r--r--[-rwxr-xr-x]src/command.c0
-rw-r--r--[-rwxr-xr-x]src/data.c0
-rw-r--r--[-rwxr-xr-x]src/draw.c0
-rw-r--r--[-rwxr-xr-x]src/dynamic.c0
-rw-r--r--[-rwxr-xr-x]src/eval.c86
-rw-r--r--[-rwxr-xr-x]src/fen.c0
-rw-r--r--[-rwxr-xr-x]src/gamelist.c0
-rw-r--r--[-rwxr-xr-x]src/generate.c0
-rw-r--r--[-rwxr-xr-x]src/hash.c0
-rw-r--r--[-rwxr-xr-x]src/ics.c0
-rw-r--r--[-rwxr-xr-x]src/input.c0
-rw-r--r--[-rwxr-xr-x]src/main.c0
-rw-r--r--[-rwxr-xr-x]src/move.c0
-rw-r--r--[-rwxr-xr-x]src/movesup.c0
-rw-r--r--[-rwxr-xr-x]src/pawnhash.c0
-rw-r--r--[-rwxr-xr-x]src/piece.c0
-rw-r--r--[-rwxr-xr-x]src/root.c0
-rw-r--r--[-rwxr-xr-x]src/san.c0
-rw-r--r--[-rwxr-xr-x]src/script.c0
-rw-r--r--[-rwxr-xr-x]src/search.c16
-rw-r--r--[-rwxr-xr-x]src/see.c0
-rw-r--r--[-rwxr-xr-x]src/sig.c0
-rw-r--r--[-rwxr-xr-x]src/split.c0
-rw-r--r--[-rwxr-xr-x]src/testeval.c0
-rw-r--r--[-rwxr-xr-x]src/testfen.c0
-rw-r--r--[-rwxr-xr-x]src/testgenerate.c0
-rw-r--r--[-rwxr-xr-x]src/testics.c0
-rw-r--r--[-rwxr-xr-x]src/testmove.c0
-rw-r--r--[-rwxr-xr-x]src/util.c0
-rw-r--r--[-rwxr-xr-x]src/win32.c0
33 files changed, 33 insertions, 69 deletions
diff --git a/src/bitboard.c b/src/bitboard.c
index 2832fdb..2832fdb 100755..100644
--- a/src/bitboard.c
+++ b/src/bitboard.c
diff --git a/src/board.c b/src/board.c
index 9ed2f03..9ed2f03 100755..100644
--- a/src/board.c
+++ b/src/board.c
diff --git a/src/book.c b/src/book.c
index 1a5580b..1a5580b 100755..100644
--- a/src/book.c
+++ b/src/book.c
diff --git a/src/command.c b/src/command.c
index e6bf9fc..e6bf9fc 100755..100644
--- a/src/command.c
+++ b/src/command.c
diff --git a/src/data.c b/src/data.c
index 7c84b1a..7c84b1a 100755..100644
--- a/src/data.c
+++ b/src/data.c
diff --git a/src/draw.c b/src/draw.c
index 7df10b4..7df10b4 100755..100644
--- a/src/draw.c
+++ b/src/draw.c
diff --git a/src/dynamic.c b/src/dynamic.c
index 992b842..992b842 100755..100644
--- a/src/dynamic.c
+++ b/src/dynamic.c
diff --git a/src/eval.c b/src/eval.c
index 5522d2d..26b7ace 100755..100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1261,10 +1261,12 @@ Return value:
{
COOR c1, cSquare;
PIECE pSentry, pHelper;
- ULONG uPawnFile = FILE(c) + 1;
+ ULONG ucFile = FILE(c);
+ ULONG uPawnFile = ucFile + 1;
BITBOARD bb;
ULONG uSentries, uHelpers;
ULONG uColor;
+ ULONG xColor;
int d1;
#ifdef DEBUG
COOR cVerifySquare;
@@ -1278,54 +1280,49 @@ Return value:
ASSERT(IS_PAWN(pHelper));
uColor = GET_COLOR(pHelper);
ASSERT(IS_VALID_COLOR(uColor));
+ xColor = FLIP(uColor);
- if (pHash->uCountPerFile[FLIP(uColor)][uPawnFile] != 0)
+ // The only way a pawn can be a passer/candidate if the other
+ // side has a pawn on its same file is if that enemy pawn is
+ // behind it. This is a corner case but it is important to
+ // detect all passers.
+ if (pHash->uCountPerFile[xColor][uPawnFile] != 0)
{
- ASSERT((pos->bbPawns[FLIP(uColor)] & BBFILE[FILE(c)]) != 0);
-
- //
- // The only way a pawn can be a passer/candidate if the other
- // side has a pawn on its same file is if that enemy pawn is
- // behind it. This is a corner case but it is important to
- // detect all passers.
- //
+ ASSERT((pos->bbPawns[xColor] & BBFILE[ucFile]) != 0);
switch(uColor)
{
case WHITE:
- bb = pos->bbPawns[BLACK] & BBFILE[FILE(c)];
+ bb = pos->bbPawns[BLACK] & BBFILE[ucFile];
ASSERT(bb);
while(IS_ON_BOARD(c1 = CoorFromBitBoardRank8ToRank1(&bb)))
{
- ASSERT(FILE(c1) == FILE(c));
+ ASSERT(FILE(c1) == ucFile);
if (c1 < c) return;
}
break;
case BLACK:
- bb = pos->bbPawns[WHITE] & BBFILE[FILE(c)];
+ bb = pos->bbPawns[WHITE] & BBFILE[ucFile];
ASSERT(bb);
while(IS_ON_BOARD(c1 = CoorFromBitBoardRank1ToRank8(&bb)))
{
- ASSERT(FILE(c1) == FILE(c));
+ ASSERT(FILE(c1) == ucFile);
if (c1 > c) return;
}
break;
}
}
- //
- // Count FLIP(uColor)'s sentries and determine the location of the
- // critical square. Note if there are no sentries then this
- // pawn (on square c) is a passer already, not a candidate.
- //
- bb = pos->bbPawns[FLIP(uColor)] & BBADJACENT_FILES[FILE(c)];
+ // Count xColor's sentry pawns and determine the location of the
+ // critical square for the pawn at c to become a passer. Note if
+ // there are no sentries then this pawn (on square c) is a passer
+ // already, not a candidate.
+ bb = pos->bbPawns[xColor] & BBADJACENT_FILES[ucFile];
bb &= BBPRECEEDING_RANKS[(c & 0x70) >> 4][uColor];
if (!bb)
{
ASSERT(CountBits(bb) == 0);
- //
- // There are no sentries so this pawn is a passer.
- //
+ // There are no enemy sentries so this pawn is a passer.
pHash->bbPasserLocations[uColor] |= COOR_TO_BB(c);
ASSERT(CountBits(pHash->bbPasserLocations[uColor]) > 0);
ASSERT(CountBits(pHash->bbPasserLocations[uColor]) <= 8);
@@ -1336,9 +1333,7 @@ Return value:
PASSER_BY_RANK[uColor][RANK(c)],
"passed pawn");
- //
// However, don't give doubled passers such a big bonus.
- //
if (IS_PAWN(pos->rgSquare[c - 16 * g_iAhead[uColor]].pPiece))
{
EVAL_TERM(uColor,
@@ -1352,10 +1347,10 @@ Return value:
}
uSentries = CountBits(bb);
- //
- // There's one or more sentry pawns so we'll look for helpers to
- // decide if this pawn is a candidate passer.
- //
+ // There's one or more sentry pawns so we'll look for friendly
+ // helpers to decide if this pawn is a candidate passer. First
+ // figure out the critical square we need to get the passer
+ // through.
if (uColor == WHITE)
{
pSentry = BLACK_PAWN;
@@ -1369,9 +1364,9 @@ Return value:
cSquare -= 0x10;
}
cSquare &= 0xF0;
- cSquare |= FILE(c);
+ cSquare |= ucFile;
ASSERT(IS_ON_BOARD(cSquare));
- ASSERT(FILE(cSquare) == FILE(c));
+ ASSERT(FILE(cSquare) == ucFile);
#ifdef DEBUG
uVerifySentries = 0;
@@ -1443,26 +1438,21 @@ Return value:
if ((IS_ON_BOARD(c1)) && (pHash->uCountPerFile[uColor][FILE(c1) + 1]))
{
ASSERT(pos->bbPawns[uColor] & BBFILE[FILE(c1)]);
- if (!(pos->bbPawnAttacks[FLIP(uColor)] & COOR_TO_BB(c1)) ||
+ if (!(pos->bbPawnAttacks[xColor] & COOR_TO_BB(c1)) ||
(pos->bbPawnAttacks[uColor] & COOR_TO_BB(c1)))
{
- //
- // The square c1 the place a helper pawn must get to in
- // order to aide the candidate past a sentry.
- //
+ // Friend helper pawn there?
if (pos->rgSquare[c1].pPiece == pHelper)
{
uHelpers = 1;
goto do_left;
}
- //
// There is no helper pawn in the support position yet.
// See if one can get there.
- //
c1 = c1 - d1;
while (IS_ON_BOARD(c1) &&
- ((!(pos->bbPawnAttacks[FLIP(uColor)] & COOR_TO_BB(c1))) ||
+ ((!(pos->bbPawnAttacks[xColor] & COOR_TO_BB(c1))) ||
(pos->bbPawnAttacks[uColor] & COOR_TO_BB(c1))))
{
if (pos->rgSquare[c1].pPiece == pHelper)
@@ -1485,26 +1475,21 @@ Return value:
{
ASSERT(pos->bbPawns[uColor] & BBFILE[FILE(c1)]);
- if (!(pos->bbPawnAttacks[FLIP(uColor)] & COOR_TO_BB(c1)) ||
+ if (!(pos->bbPawnAttacks[xColor] & COOR_TO_BB(c1)) ||
(pos->bbPawnAttacks[uColor] & COOR_TO_BB(c1)))
{
- //
- // The square c1 is the place a helper pawn must get to in
- // order to aide the candidate.
- //
+ // Already a helper there?
if (pos->rgSquare[c1].pPiece == pHelper)
{
uHelpers++;
goto done_helpers;
}
- //
// There is no pawn in the left support position yet. See
// if one can get there.
- //
c1 -= d1;
while (IS_ON_BOARD(c1) &&
- ((!(pos->bbPawnAttacks[FLIP(uColor)] & COOR_TO_BB(c1))) ||
+ ((!(pos->bbPawnAttacks[xColor] & COOR_TO_BB(c1))) ||
(pos->bbPawnAttacks[uColor] & COOR_TO_BB(c1))))
{
if (pos->rgSquare[c1].pPiece == pHelper)
@@ -1536,14 +1521,12 @@ Return value:
CANDIDATE_PASSER_BY_RANK[uColor][RANK(c)],
"candidate passer");
- //
// If the other side has no pieces then give this candidate an
// extra bonus -- used to be a second full copy of the same
// CANDIDATE_PASSER_BY_RANK value (an exact duplicate of the
// term just added above, not a different angle on it), now a
// fractional modifier.
- //
- if (pos->uNonPawnCount[FLIP(uColor)][0] == 1)
+ if (pos->uNonPawnCount[xColor][0] == 1)
{
EVAL_TERM(uColor,
PAWN,
@@ -1588,7 +1571,6 @@ Return value:
FOREACH_COLOR(uColor)
{
ASSERT(IS_VALID_COLOR(uColor));
-
if (pHash->bbPasserLocations[uColor])
{
ASSERT(pos->uPawnCount[uColor] > 0);
@@ -1602,10 +1584,8 @@ Return value:
ASSERT(pHash->uCountPerFile[uColor][u+1] != 0);
while(IS_ON_BOARD(c = CoorFromBitBoardRank8ToRank1(&bb)))
{
- //
// Keep track of leftmost/rightmost passer for
// outside passer code later on.
- //
ASSERT(FILE(c) == u);
ASSERT(RANK(c) > 1);
ASSERT(RANK(c) < 8);
diff --git a/src/fen.c b/src/fen.c
index 33810e6..33810e6 100755..100644
--- a/src/fen.c
+++ b/src/fen.c
diff --git a/src/gamelist.c b/src/gamelist.c
index 6adf151..6adf151 100755..100644
--- a/src/gamelist.c
+++ b/src/gamelist.c
diff --git a/src/generate.c b/src/generate.c
index 6f92382..6f92382 100755..100644
--- a/src/generate.c
+++ b/src/generate.c
diff --git a/src/hash.c b/src/hash.c
index c5e5f85..c5e5f85 100755..100644
--- a/src/hash.c
+++ b/src/hash.c
diff --git a/src/ics.c b/src/ics.c
index 0ace535..0ace535 100755..100644
--- a/src/ics.c
+++ b/src/ics.c
diff --git a/src/input.c b/src/input.c
index 6a35ab8..6a35ab8 100755..100644
--- a/src/input.c
+++ b/src/input.c
diff --git a/src/main.c b/src/main.c
index 351e848..351e848 100755..100644
--- a/src/main.c
+++ b/src/main.c
diff --git a/src/move.c b/src/move.c
index 1da5546..1da5546 100755..100644
--- a/src/move.c
+++ b/src/move.c
diff --git a/src/movesup.c b/src/movesup.c
index 82ba10a..82ba10a 100755..100644
--- a/src/movesup.c
+++ b/src/movesup.c
diff --git a/src/pawnhash.c b/src/pawnhash.c
index 8af2138..8af2138 100755..100644
--- a/src/pawnhash.c
+++ b/src/pawnhash.c
diff --git a/src/piece.c b/src/piece.c
index d5eeece..d5eeece 100755..100644
--- a/src/piece.c
+++ b/src/piece.c
diff --git a/src/root.c b/src/root.c
index 5b51009..5b51009 100755..100644
--- a/src/root.c
+++ b/src/root.c
diff --git a/src/san.c b/src/san.c
index 0bb41e4..0bb41e4 100755..100644
--- a/src/san.c
+++ b/src/san.c
diff --git a/src/script.c b/src/script.c
index 0bc09e4..0bc09e4 100755..100644
--- a/src/script.c
+++ b/src/script.c
diff --git a/src/search.c b/src/search.c
index fdcb955..fae2567 100755..100644
--- a/src/search.c
+++ b/src/search.c
@@ -356,7 +356,6 @@ Search(IN SEARCHER_THREAD_CONTEXT *ctx,
iImprovement = (iEval - ctx->sPlyInfo[ctx->uPly - 2].iEval);
}
-
GENERATE_NO_MOVES;
if (!fSkipNull &&
!fThreat &&
@@ -486,21 +485,6 @@ Search(IN SEARCHER_THREAD_CONTEXT *ctx,
ctx->sSearchFlags.fAvoidNullmove = TRUE;
RescoreMovesViaSearch(ctx, uDepth, iAlpha, iBeta);
ctx->sSearchFlags.fAvoidNullmove = FALSE;
- // NOT always TRUE here -- pre-existing bug, found
- // via debug_smoke_test.sh (a deeper/larger-than-
- // usual sample finally hit the rare path).
- // RescoreMovesViaSearch's own fail-high branch
- // (searchsup.c) deliberately leaves this FALSE by
- // design -- a fail-high only proves uBest is good
- // enough, not honest eval-axis scores for every
- // move, so claiming fMovesRescoredByIID would be a
- // lie. This assert demanded the opposite of that
- // documented contract; DO_IID is unconditionally
- // compiled in (chess.h) so this could fire on any
- // DEBUG build given an unlucky enough rescore --
- // ASSERT is a no-op in release, so this never
- // crashed in production, but it made the DEBUG/
- // TEST harness itself unreliable at random.
}
}
#endif
diff --git a/src/see.c b/src/see.c
index 893a9bb..893a9bb 100755..100644
--- a/src/see.c
+++ b/src/see.c
diff --git a/src/sig.c b/src/sig.c
index 366692d..366692d 100755..100644
--- a/src/sig.c
+++ b/src/sig.c
diff --git a/src/split.c b/src/split.c
index f8da7ed..f8da7ed 100755..100644
--- a/src/split.c
+++ b/src/split.c
diff --git a/src/testeval.c b/src/testeval.c
index ee9c6a2..ee9c6a2 100755..100644
--- a/src/testeval.c
+++ b/src/testeval.c
diff --git a/src/testfen.c b/src/testfen.c
index 6cb2903..6cb2903 100755..100644
--- a/src/testfen.c
+++ b/src/testfen.c
diff --git a/src/testgenerate.c b/src/testgenerate.c
index c6947d2..c6947d2 100755..100644
--- a/src/testgenerate.c
+++ b/src/testgenerate.c
diff --git a/src/testics.c b/src/testics.c
index b82450b..b82450b 100755..100644
--- a/src/testics.c
+++ b/src/testics.c
diff --git a/src/testmove.c b/src/testmove.c
index 6711046..6711046 100755..100644
--- a/src/testmove.c
+++ b/src/testmove.c
diff --git a/src/util.c b/src/util.c
index a8ecc3c..a8ecc3c 100755..100644
--- a/src/util.c
+++ b/src/util.c
diff --git a/src/win32.c b/src/win32.c
index 3b65779..3b65779 100755..100644
--- a/src/win32.c
+++ b/src/win32.c