From 1b006985ba2381a29dd9aa34aec1dafbae224897 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 31 Jul 2026 20:27:02 +0200 Subject: using cpp check on this project --- src/board/board.cpp | 11 ++--------- src/board/board.hpp | 7 +++---- src/board/fen.cpp | 2 +- src/board/fen.hpp | 2 +- 4 files changed, 7 insertions(+), 15 deletions(-) (limited to 'src/board') 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 #include -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_ */ -- cgit v1.2.3