diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/board.cpp | 11 | ||||
| -rw-r--r-- | src/board.hpp | 2 | ||||
| -rw-r--r-- | src/fen.cpp | 2 | ||||
| -rw-r--r-- | src/main.cpp | 2 | ||||
| -rw-r--r-- | src/moves.cpp | 5 |
5 files changed, 11 insertions, 11 deletions
diff --git a/src/board.cpp b/src/board.cpp index 081cc7d..172a9be 100644 --- a/src/board.cpp +++ b/src/board.cpp @@ -5,13 +5,11 @@ #include <iostream> #include <print> #include <string> -#include <utility> - -const char toChar(pieceType type) { +char toChar(pieceType type) { switch (type) { case NONE: - return '.'; + return '.'; case PAWN: return 'P'; case KNIGHT: @@ -25,7 +23,8 @@ const char toChar(pieceType type) { case KING: return 'K'; default: - assert(false && "Unknown piece"); + std::cout << "\n" << type << "\n"; + assert(false && "Unknown piece" && type); return '?'; } } @@ -90,4 +89,4 @@ void printBoard(board *b) { std::println("Castling: {}", b->castle); } -void PlayMove(Move move, board *b) { return; } +// void PlayMove(Move move, board *b) { return; } diff --git a/src/board.hpp b/src/board.hpp index 23f89ad..afdb938 100644 --- a/src/board.hpp +++ b/src/board.hpp @@ -13,7 +13,7 @@ enum pieceType { KING, }; -const char toChar(pieceType type); +char toChar(pieceType type); struct Piece { bool color; diff --git a/src/fen.cpp b/src/fen.cpp index a6773c2..9c3154c 100644 --- a/src/fen.cpp +++ b/src/fen.cpp @@ -25,7 +25,7 @@ void setBoardFen(std::string fen, board *b) { }; parserState state = POSITION; - for (int i = 0; i < fen.length(); i++) { + for (uint i = 0; i < fen.length(); i++) { std::printf("state: %d\n", state); std::printf("doing: %c\n", fen[i]); if (fen[i] == ' ') { diff --git a/src/main.cpp b/src/main.cpp index 7a6e7f4..261c19d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -127,7 +127,7 @@ int main(int argc, char **argv) { continue; } std::println(); - PlayMove(move, &b); + // PlayMove(move, &b); // todo implement b.MoveClock++; b.turn = !b.turn; printBoard(&b); diff --git a/src/moves.cpp b/src/moves.cpp index 2ff8ed6..f02dfbe 100644 --- a/src/moves.cpp +++ b/src/moves.cpp @@ -1,5 +1,6 @@ #include <array> #include <cstdint> +#include <sys/types.h> #include "board.hpp" #include "moves.hpp" @@ -11,7 +12,7 @@ std::vector<Move> GetLegalMoves(board *b) { constexpr std::array<int, 4> rook_Moves{-1, 1, 8, -8}; constexpr std::array<int, 4> bishop_Moves{-9, 9, -7, 7}; - for (int i = 0; i < sizeof(b->pieces) / sizeof(b->pieces[0]); i++) { + for (uint i = 0; i < sizeof(b->pieces) / sizeof(b->pieces[0]); i++) { Piece piece = b->pieces[i]; if (piece.type == NONE) { continue; @@ -42,7 +43,7 @@ Position IndexToPosition(int i) { void GenerateSlidingMoves(board *b, int from, const std::array<int, 4> &directions, std::vector<Move> &moves) { - for (int i = 0; i < directions.size(); i++) { + for (uint i = 0; i < directions.size(); i++) { int direction = directions[i]; int i2 = from; |
