aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/cmake-single-platform.yml3
-rw-r--r--src/board/board.cpp11
-rw-r--r--src/board/board.hpp7
-rw-r--r--src/board/fen.cpp2
-rw-r--r--src/board/fen.hpp2
-rw-r--r--src/bot.cpp2
-rw-r--r--src/evaluate.cpp2
-rw-r--r--src/evaluate.hpp2
-rw-r--r--src/main.cpp2
-rw-r--r--src/uci.cpp4
-rw-r--r--src/uci.hpp2
-rw-r--r--src/zobrist.cpp (renamed from src/zobrist/zobrist.cpp)2
-rw-r--r--src/zobrist.hpp (renamed from src/zobrist/zobrist.hpp)2
13 files changed, 16 insertions, 27 deletions
diff --git a/.github/workflows/cmake-single-platform.yml b/.github/workflows/cmake-single-platform.yml
index 408b9be..d768361 100644
--- a/.github/workflows/cmake-single-platform.yml
+++ b/.github/workflows/cmake-single-platform.yml
@@ -32,6 +32,3 @@ jobs:
CC: gcc-14
CXX: g++-14
run: cmake --build build
-
- - name: Run clang-tidy
- run: clang-tidy src/*.cpp -p build
diff --git a/src/board/board.cpp b/src/board/board.cpp
index af313d0..2cd705d 100644
--- a/src/board/board.cpp
+++ b/src/board/board.cpp
@@ -1,16 +1,9 @@
#include "board.hpp"
-#include "../moves.hpp"
-#include "zobrist/zobrist.hpp"
+#include "moves.hpp"
+#include "zobrist.hpp"
#include <cassert>
#include <cstdlib>
-Piece createPiece(PieceType type, bool color) {
- Piece piece;
- piece.type = type;
- piece.color = color;
- return piece;
-}
-
int PositionToIndex(Position i) { return i.rank * 8 + i.file; }
Position FindKing(Game *b, bool color) {
diff --git a/src/board/board.hpp b/src/board/board.hpp
index 5d0d913..bcd0b95 100644
--- a/src/board/board.hpp
+++ b/src/board/board.hpp
@@ -45,9 +45,9 @@ struct Move {
enum Flag { EXACT, LOWERBOUND, UPPERBOUND };
struct TranspositionsEntry {
- int depth;
- int Eval;
- Flag flag;
+ int depth = -1;
+ int Eval = 0;
+ Flag flag = EXACT;
Move bestMove = {};
};
struct Game {
@@ -96,7 +96,6 @@ struct UndoMove {
bool wasCastle = false;
bool CastledSide = false; // 0 for queen side, 1 for king side
};
-Piece createPiece(PieceType type, bool color);
int PositionToIndex(Position i);
UndoMove MakeMove(Move move, Game *g);
diff --git a/src/board/fen.cpp b/src/board/fen.cpp
index faa8f83..a7e65eb 100644
--- a/src/board/fen.cpp
+++ b/src/board/fen.cpp
@@ -11,7 +11,7 @@
bool WHITE = true;
bool BLACK = false;
-void setBoardFen(std::string fen, Game *g) {
+void setBoardFen(const std::string fen, Game *g) {
// example fen rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
int file = 0;
int rank = 0;
diff --git a/src/board/fen.hpp b/src/board/fen.hpp
index 406f5fe..7af3db3 100644
--- a/src/board/fen.hpp
+++ b/src/board/fen.hpp
@@ -5,5 +5,5 @@
#include "board.hpp"
-void setBoardFen(std::string fen, Game *b);
+void setBoardFen(const std::string fen, Game *b);
#endif /* SRC_FEN_H_ */
diff --git a/src/bot.cpp b/src/bot.cpp
index 0358241..3ea6620 100644
--- a/src/bot.cpp
+++ b/src/bot.cpp
@@ -2,7 +2,7 @@
#include "board/board.hpp"
#include "evaluate.hpp"
#include "moves.hpp"
-#include "zobrist/zobrist.hpp"
+#include "zobrist.hpp"
#include <algorithm>
#include <cassert>
diff --git a/src/evaluate.cpp b/src/evaluate.cpp
index 7d0a78e..a777e0c 100644
--- a/src/evaluate.cpp
+++ b/src/evaluate.cpp
@@ -150,7 +150,7 @@ int CountBoardMaterial(Game *g) {
return score;
};
-bool IsEndgame(Game *g) {
+bool IsEndgame(const Game *g) {
int queens = 0;
int rooks = 0;
diff --git a/src/evaluate.hpp b/src/evaluate.hpp
index feeff70..66b362d 100644
--- a/src/evaluate.hpp
+++ b/src/evaluate.hpp
@@ -9,6 +9,6 @@
*/
int EvaluateBoardForWhite(Game *g);
-bool IsEndgame(Game *g);
+bool IsEndgame(const Game *g);
#endif /* SRC_EVALUATE_H_ */
diff --git a/src/main.cpp b/src/main.cpp
index 25082be..4469e40 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,6 +1,6 @@
#include "misc.hpp"
#include "uci.hpp"
-#include "zobrist/zobrist.hpp"
+#include "zobrist.hpp"
#include <iostream>
int main() {
diff --git a/src/uci.cpp b/src/uci.cpp
index d9972b2..4357e99 100644
--- a/src/uci.cpp
+++ b/src/uci.cpp
@@ -4,7 +4,7 @@
#include "bot.hpp"
#include "misc.hpp"
#include "moves.hpp"
-#include "zobrist/zobrist.hpp"
+#include "zobrist.hpp"
#include <algorithm>
#include <cassert>
@@ -37,7 +37,7 @@ void LogUci(const std::string &message) {
}
using namespace std;
-Move UciToMove(string uci) {
+Move UciToMove(const string uci) {
Position from;
Position to;
diff --git a/src/uci.hpp b/src/uci.hpp
index 4564895..372f007 100644
--- a/src/uci.hpp
+++ b/src/uci.hpp
@@ -5,7 +5,7 @@
#include <string>
#include <unordered_map>
-Move UciToMove(std::string uci);
+Move UciToMove(const std::string uci);
void LogUci(const std::string &message);
void Uci();
Game initBoard(
diff --git a/src/zobrist/zobrist.cpp b/src/zobrist.cpp
index a1efd78..20ac5e9 100644
--- a/src/zobrist/zobrist.cpp
+++ b/src/zobrist.cpp
@@ -1,5 +1,5 @@
#include "zobrist.hpp"
-#include "../board/board.hpp"
+#include "board/board.hpp"
#include <random>
diff --git a/src/zobrist/zobrist.hpp b/src/zobrist.hpp
index 9433421..575d912 100644
--- a/src/zobrist/zobrist.hpp
+++ b/src/zobrist.hpp
@@ -1,5 +1,5 @@
#pragma once
-#include "../board/board.hpp"
+#include "board/board.hpp"
#include <cstdint>
extern uint64_t PieceKeys[2][7][64];