Skip to content

Commit

Permalink
Bench: 30658368
Browse files Browse the repository at this point in the history
  • Loading branch information
TerjeKir committed Nov 19, 2023
1 parent c24d871 commit 2cd896e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ CONSTR(1) InitDistance() {
}
}

int Distance(Square sq1, Square sq2) { return SqDistance[sq1][sq2]; }

// Pseudo-random number generator
static uint64_t Rand64() {

Expand Down
4 changes: 1 addition & 3 deletions src/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ typedef struct Position {

extern bool chess960;

extern uint8_t SqDistance[64][64];

extern const int NonPawn[PIECE_NB];

// Zobrist keys
Expand Down Expand Up @@ -98,10 +96,10 @@ INLINE Color ColorOf(Piece piece) { return piece >> 3;}
INLINE PieceType PieceTypeOf(Piece piece) { return piece & 7; }
INLINE Piece MakePiece(Color color, PieceType pt) { return (color << 3) + pt; }

int Distance(const Square sq1, const Square sq2);
INLINE Square MirrorSquare(const Square sq) { return sq ^ 56; } // Mirrors a square horizontally
INLINE Square RelativeSquare(const Color color, const Square sq) { return color == WHITE ? sq : MirrorSquare(sq); }
INLINE Square BlackRelativeSquare(const Color color, const Square sq) { return color == BLACK ? sq : MirrorSquare(sq); }
INLINE int Distance(const Square sq1, const Square sq2) { return SqDistance[sq1][sq2]; }
INLINE int FileOf(Square square) { return square & 7; }
INLINE int RankOf(Square square) { return square >> 3; }
INLINE int RelativeRank(Color color, int rank) { return color == WHITE ? rank : RANK_8 - rank; }
Expand Down
9 changes: 4 additions & 5 deletions src/uci.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ static void ParseTimeControl(const char *str, const Position *pos) {
char *searchmoves = strstr(str, "searchmoves ");
if (searchmoves) {
char *move = strtok(searchmoves, " ");
int i = 0;
while ((move = strtok(NULL, " ")))
Limits.searchmoves[i++] = ParseMove(move, pos);
for (int i = 0; (move = strtok(NULL, " ")); ++i)
Limits.searchmoves[i] = ParseMove(move, pos);
}

Limits.timelimit = Limits.time || Limits.movetime;
Expand All @@ -73,11 +72,11 @@ INLINE void Go(Position *pos, char *str) {
// Parses a 'position' and sets up the board
static void Pos(Position *pos, char *str) {

#define IsFen (!strncmp(str, "position fen", 12))
bool isFen = !strncmp(str, "position fen", 12);

// Set up original position. This will either be a
// position given as FEN, or the normal start position
ParseFen(IsFen ? str + 13 : START_FEN, pos);
ParseFen(isFen ? str + 13 : START_FEN, pos);

// Check if there are moves to be made from the initial position
if ((str = strstr(str, "moves")) == NULL) return;
Expand Down

0 comments on commit 2cd896e

Please sign in to comment.