diff --git a/source/board.cpp b/source/board.cpp index e89687d..de382a6 100644 --- a/source/board.cpp +++ b/source/board.cpp @@ -211,4 +211,14 @@ void Board::PrintBoard() { std::cout << "+---+---+---+---+---+---+---+---+\n"; std::cout << " a b c d e f g h\n\n"; +} + +void Board::AddMove(Move move) { + moveList.push_back(move); +} + +void Board::ListMoves() { + for (Move move : moveList) { + move.PrintMove(); + } } \ No newline at end of file diff --git a/source/board.h b/source/board.h index fa0f064..8443d2b 100644 --- a/source/board.h +++ b/source/board.h @@ -2,8 +2,12 @@ #include #include "bitboards.h" #include "types.h" +#include "movegen.h" +#include class Board { +private: + std::vector moveList; public: std::array pieces; std::array colors; @@ -13,6 +17,8 @@ public: int halfMoves = 0; int fullMoves = 0; + Move lastMove; + std::array castlingRights = { false, false, false, false }; Bitboard enPassantTarget; @@ -20,4 +26,6 @@ public: void Reset(); void SetByFen(const char* fen); void PrintBoard(); + void AddMove(Move move); + void ListMoves(); }; \ No newline at end of file diff --git a/source/movegen.cpp b/source/movegen.cpp index 28876f7..0c36390 100644 --- a/source/movegen.cpp +++ b/source/movegen.cpp @@ -16,8 +16,8 @@ static Bitboard notHfile = ~files[H]; static Bitboard notABfile = notAfile & ~files[B]; static Bitboard notHGfile = notHfile & ~files[G]; -void doMove(Move move) { - +void Move::PrintMove() { + std::cout << squareCoords[moveFrom] << squareCoords[moveTo] << '\n'; } Bitboard maskPawnAttacks(int side, int square) { diff --git a/source/movegen.h b/source/movegen.h index aa5d68e..1d8b74d 100644 --- a/source/movegen.h +++ b/source/movegen.h @@ -6,11 +6,13 @@ public: SQUARE moveFrom; SQUARE moveTo; + Move(){} + Move(const SQUARE from, const SQUARE to) : moveFrom(from), moveTo(to) {} -}; -void doMove(Move move); + void PrintMove(); +}; // bishop relevant occupancy bit count constexpr int bishopRelevantBits[64] = {