diff options
| author | Scott Gasch <[email protected]> | 2026-10-09 14:18:52 -0700 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2026-10-09 14:18:52 -0700 |
| commit | fbdcb9d76dd2444d8bc631331eaeb9435cc247f8 (patch) | |
| tree | 602ab360462d6f23188ba51f962c4abb2dc6c7e5 /src/data.c | |
| parent | 73b4afb12abf7cc442831dea42b41b63a2ce07be (diff) | |
* Grab bag of eval.c changes.
* Don't bother not hashing when moves are pruned.
* Prune moves move librerally with LMP.
Inexplicably, this is slightly shallower than HEAD (despite pruning
MORE). It may be because it is slightly slower.
It consistently beats HEAD in match_play.py though (3x now).
Diffstat (limited to 'src/data.c')
| -rw-r--r-- | src/data.c | 74 |
1 files changed, 35 insertions, 39 deletions
@@ -46,7 +46,7 @@ MOVE EGTBMOVE = {0x55558888}; FLAG g_fIsWhiteSquare[128]; #ifdef DEBUG -COOR +COOR DistanceBetweenSquares(COOR a, COOR b) { int i = (int)a - (int)b + 128; @@ -75,7 +75,7 @@ DistanceBetweenSquares(COOR a, COOR b) (((x) >= -128) && ((x) <= 127)) ULONG -CheckVectorWithIndex(int i, ULONG uColor) +CheckVectorWithIndex(int i, ULONG uColor) { ULONG u; ASSERT(VALID_INDEX(i)); @@ -95,7 +95,7 @@ CheckVectorWithIndex(int i, ULONG uColor) ((x) == +17) || ((x) == -17)) int -DirectionBetweenSquaresWithIndex(int i) +DirectionBetweenSquaresWithIndex(int i) { int iDir; ASSERT(VALID_INDEX(i)); @@ -107,14 +107,14 @@ DirectionBetweenSquaresWithIndex(int i) return(iDir); } -int -DirectionBetweenSquaresFromTo(COOR from, COOR to) +int +DirectionBetweenSquaresFromTo(COOR from, COOR to) { int i = (int)from - (int)to; return DirectionBetweenSquaresWithIndex(i); } -int +int NegativeDirectionBetweenSquaresWithIndex(int i) { int iDir; @@ -126,7 +126,7 @@ NegativeDirectionBetweenSquaresWithIndex(int i) ASSERT(iDir == -g_pVectorDelta[i].iDelta); return(iDir); } - + int DirectionBetweenSquares(COOR cFrom, COOR cTo) { @@ -134,8 +134,8 @@ DirectionBetweenSquares(COOR cFrom, COOR cTo) return(DirectionBetweenSquaresWithIndex(i)); } -FLAG -IsSquareWhite(COOR c) +FLAG +IsSquareWhite(COOR c) { BITBOARD bb; FLAG f = IS_WHITE_SQUARE_COOR(c); @@ -153,7 +153,7 @@ VerifyVectorDelta(void) { int iIndex; int iChecksum = 0; - + for (iIndex = 0; iIndex < 256; iIndex++) @@ -162,33 +162,32 @@ VerifyVectorDelta(void) ASSERT(VALID_VECTOR(g_VectorDelta[iIndex].iVector[WHITE])); ASSERT(VALID_DELTA(g_VectorDelta[iIndex].iDelta)); ASSERT(VALID_DELTA(g_VectorDelta[iIndex].iNegDelta)); - ASSERT(-g_VectorDelta[iIndex].iDelta == + ASSERT(-g_VectorDelta[iIndex].iDelta == g_VectorDelta[iIndex].iNegDelta); iChecksum += g_VectorDelta[iIndex].iVector[BLACK] * iIndex; iChecksum += g_VectorDelta[iIndex].iVector[WHITE] * iIndex; iChecksum += g_VectorDelta[iIndex].iDelta * iIndex; } - if (iChecksum != 0xb1b58) { UtilPanic(DETECTED_INCORRECT_INITIALIZATION, NULL, "vector/delta", (void *)(size_t)iChecksum, - (void *)(size_t)0xb1b58, + (void *)(size_t)0xb1b58, __FILE__, __LINE__); } } void -InitializeWhiteSquaresTable(void) +InitializeWhiteSquaresTable(void) { COOR c; FOREACH_SQUARE(c) { g_fIsWhiteSquare[c] = FALSE; - if (!IS_ON_BOARD(c)) + if (!IS_ON_BOARD(c)) { continue; } @@ -206,10 +205,10 @@ InitializeVectorDeltaTable(void) PIECE p; int iDir; ULONG u; - static const BYTE _LOCATIONS[] = + static const BYTE _LOCATIONS[] = { - D4, A5, A3, G3, C1, B5, H4, E5, E3, A6, C5, A5, A5, - G5, A6, D3, D2, A5, E1, E1, A6, H4, B2, D1, D2, E5 + D4, A5, A3, G3, C1, B5, H4, E5, E3, A6, C5, A5, A5, + G5, A6, D3, D2, A5, E1, E1, A6, H4, B2, D1, D2, E5 }; static int iNumDirs[7] = { 0, 0, 8, 4, 4, 8, 8 }; static int iDelta[7][8] = { { 0, 0, 0, 0, 0, 0, 0, 0 }, @@ -224,14 +223,14 @@ InitializeVectorDeltaTable(void) FOREACH_SQUARE(cStart) { if (!IS_ON_BOARD(cStart)) continue; - for (u = 0; u < ARRAY_LENGTH(_LOCATIONS); u++) + for (u = 0; u < ARRAY_LENGTH(_LOCATIONS); u++) { - if (cStart == _LOCATIONS[u]) + if (cStart == _LOCATIONS[u]) { iIndex = 0; } } - + // // Do the pawn bits // @@ -239,19 +238,19 @@ InitializeVectorDeltaTable(void) g_VectorDelta[iIndex].iVector[WHITE] |= (1 << PAWN); iIndex = (int)cStart - ((int)cStart - 15) + 128; g_VectorDelta[iIndex].iVector[WHITE] |= (1 << PAWN); - + iIndex = (int)cStart - ((int)cStart + 17) + 128; g_VectorDelta[iIndex].iVector[BLACK] |= (1 << PAWN); iIndex = (int)cStart - ((int)cStart + 15) + 128; g_VectorDelta[iIndex].iVector[BLACK] |= (1 << PAWN); - + // // Do the piece bits // for (p = KNIGHT; p <= KING; p++) { - for (iDir = 0; - iDir < iNumDirs[p]; + for (iDir = 0; + iDir < iNumDirs[p]; iDir++) { cRay = cStart; @@ -259,13 +258,13 @@ InitializeVectorDeltaTable(void) while (IS_ON_BOARD(cNew)) { iIndex = (int)cStart - (int)cNew + 128; - + // // Fill in the vector // g_VectorDelta[iIndex].iVector[WHITE] |= (1 << p); g_VectorDelta[iIndex].iVector[BLACK] |= (1 << p); - + // // Fill in the delta // @@ -280,7 +279,7 @@ InitializeVectorDeltaTable(void) { g_VectorDelta[iIndex].iDelta = -16; g_VectorDelta[iIndex].iNegDelta = 16; - } + } } else if (RANK(cStart) == RANK(cNew)) { @@ -322,7 +321,7 @@ InitializeVectorDeltaTable(void) } } cNew += iDelta[p][iDir]; - + if ((KING == p) || (KNIGHT == p)) { break; @@ -331,7 +330,7 @@ InitializeVectorDeltaTable(void) } } } - + (void)VerifyVectorDelta(); #ifdef OSX // @@ -350,13 +349,10 @@ InitializeVectorDeltaTable(void) #endif } -// -// TODO: fix this to use attack counts also -// void InitializeSwapTable(void) { - ULONG GET_HIGH_BIT[32] = + ULONG GET_HIGH_BIT[32] = { 0, // 00000 = 0 1, // 00001 = 1 @@ -523,7 +519,7 @@ InitializeSwapTable(void) } void -InitializeDistanceTable(void) +InitializeDistanceTable(void) { COOR x, y; int i; @@ -531,10 +527,10 @@ InitializeDistanceTable(void) int j; #endif - for (x = 0; x < 128; x++) + for (x = 0; x < 128; x++) { if (!IS_ON_BOARD(x)) continue; - for (y = 0; y < 128; y++) + for (y = 0; y < 128; y++) { if (!IS_ON_BOARD(y)) continue; i = (int)x - (int)y; @@ -546,10 +542,10 @@ InitializeDistanceTable(void) } #ifdef DEBUG - for (x = 0; x < 128; x++) + for (x = 0; x < 128; x++) { if (!IS_ON_BOARD(x)) continue; - for (y = 0; y < 128; y++) + for (y = 0; y < 128; y++) { if (!IS_ON_BOARD(y)) continue; i = (int)x - (int)y + 128; |
