Skip to content

Commit

Permalink
Bench: 29925582
Browse files Browse the repository at this point in the history
  • Loading branch information
TerjeKir committed Nov 25, 2023
1 parent 05f856f commit 6cf7bc4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/bitboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static void InitNonSliderAttacks() {

int KSteps[8] = { -9, -8, -7, -1, 1, 7, 8, 9 };
int NSteps[8] = { -17,-15,-10, -6, 6, 10, 15, 17 };
int PSteps[COLOR_NB][2] = { { -9, -7 }, { 7, 9 } };
int PSteps[COLOR_NB][2] = { { 7, 9 }, { -9, -7 } };

for (Square sq = A1; sq <= H8; ++sq) {

Expand Down
10 changes: 5 additions & 5 deletions src/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ uint64_t PieceKeys[PIECE_NB][64];
uint64_t CastleKeys[16];
uint64_t SideKey;

static const char PieceChars[] = ".pnbrqk..PNBRQK";
static const char PieceChars[] = ".PNBRQK..pnbrqk";

uint8_t CastlePerm[64];
Bitboard CastlePath[16];
Expand Down Expand Up @@ -120,7 +120,7 @@ static Key GenMaterialKey(const Position *pos) {

Key key = 0;

for (Color c = BLACK; c <= WHITE; ++c)
for (Color c = BLACK; c >= WHITE; --c)
for (PieceType pt = PAWN; pt <= KING; ++pt)
for (int count = 0; count < PopCount(colorPieceBB(c, pt)); ++count)
key ^= PieceKeys[MakePiece(c, pt)][count];
Expand Down Expand Up @@ -390,7 +390,7 @@ INLINE uint32_t Hash2(Key hash) { return (hash >> 16) & 0x1fff; }
CONSTR(3) InitCuckoo() {
int validate = 0;

for (Color c = BLACK; c <= WHITE; c++)
for (Color c = BLACK; c >= WHITE; c--)
for (PieceType pt = KNIGHT; pt <= KING; ++pt)
for (Square sq1 = A1; sq1 <= H8; sq1++)
for (Square sq2 = sq1 + 1; sq2 <= H8; sq2++) {
Expand Down Expand Up @@ -482,7 +482,7 @@ static Key GenPawnKey(const Position *pos) {

Key key = 0;

for (Color c = BLACK; c <= WHITE; c++) {
for (Color c = BLACK; c >= WHITE; c--) {
Bitboard pawns = colorPieceBB(c, PAWN);
while (pawns)
key ^= PieceKeys[MakePiece(c, PAWN)][PopLsb(&pawns)];
Expand All @@ -506,7 +506,7 @@ bool PositionOk(const Position *pos) {
nonPawnCount[color] += NonPawn[piece];
}

for (Color c = BLACK; c <= WHITE; ++c) {
for (Color c = BLACK; c >= WHITE; --c) {
assert(PopCount(colorPieceBB(c, PAWN)) == counts[MakePiece(c, PAWN)]);
assert(PopCount(colorPieceBB(c, KNIGHT)) == counts[MakePiece(c, KNIGHT)]);
assert(PopCount(colorPieceBB(c, BISHOP)) == counts[MakePiece(c, BISHOP)]);
Expand Down
4 changes: 2 additions & 2 deletions src/syzygy.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static bool ProbeWDL(const Position *pos, int *score, int *bound, int ply) {
pieceBB(KING), pieceBB(QUEEN),
pieceBB(ROOK), pieceBB(BISHOP),
pieceBB(KNIGHT), pieceBB(PAWN),
pos->epSquare, sideToMove);
pos->epSquare, !sideToMove);

// Probe failed
if (result == TB_RESULT_FAILED)
Expand All @@ -75,7 +75,7 @@ static bool ProbeRoot(const Position *pos, Move *move, unsigned *wdl, unsigned *
pieceBB(KING), pieceBB(QUEEN),
pieceBB(ROOK), pieceBB(BISHOP),
pieceBB(KNIGHT), pieceBB(PAWN),
pos->rule50, pos->epSquare, sideToMove);
pos->rule50, pos->epSquare, !sideToMove);

// Probe failed
if ( result == TB_RESULT_FAILED
Expand Down
6 changes: 3 additions & 3 deletions src/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ enum Score {
};

enum Color {
BLACK, WHITE, COLOR_NB
WHITE, BLACK, COLOR_NB
};

enum PieceType {
Expand All @@ -86,8 +86,8 @@ enum PieceType {

enum Piece {
EMPTY,
bP = 1, bN, bB, bR, bQ, bK,
wP = 9, wN, wB, wR, wQ, wK,
wP = 1, wN, wB, wR, wQ, wK,
bP = 9, bN, bB, bR, bQ, bK,
PIECE_NB = 16
};

Expand Down

0 comments on commit 6cf7bc4

Please sign in to comment.