diff --git a/source/board.cpp b/source/board.cpp index 2e9132c..e89687d 100644 --- a/source/board.cpp +++ b/source/board.cpp @@ -179,4 +179,36 @@ void Board::SetByFen(const char* fen) { } occupied = (colors[White] | colors[Black]); +} + +void Board::PrintBoard() { + + for (int rank = 7; rank >= 0; rank--) { + + std::cout << "+---+---+---+---+---+---+---+---+\n"; + std::cout << "| "; + + for (int file = 0; file < 8; file++) { + int square = rank * 8 + file; + bool pieceSet = false; + + for (int i = Pawn; i <= King; i++) { + if ((colors[White] & pieces[i]).IsSet(square)) { + std::cout << PIECE_LETTERS[i * 2 + White] << " | "; + pieceSet = true; + } else if ((colors[Black] & pieces[i]).IsSet(square)) { + std::cout << PIECE_LETTERS[i * 2 + Black] << " | "; + pieceSet = true; + } + } + + if (!pieceSet) { + std::cout << " | "; + } + } + std::cout << ' ' << rank + 1 << '\n'; + } + + std::cout << "+---+---+---+---+---+---+---+---+\n"; + std::cout << " a b c d e f g h\n\n"; } \ No newline at end of file diff --git a/source/board.h b/source/board.h index bdef468..fa0f064 100644 --- a/source/board.h +++ b/source/board.h @@ -19,4 +19,5 @@ public: void Init(); void Reset(); void SetByFen(const char* fen); + void PrintBoard(); }; \ No newline at end of file diff --git a/source/movegen.cpp b/source/movegen.cpp index 7099195..28876f7 100644 --- a/source/movegen.cpp +++ b/source/movegen.cpp @@ -16,6 +16,10 @@ static Bitboard notHfile = ~files[H]; static Bitboard notABfile = notAfile & ~files[B]; static Bitboard notHGfile = notHfile & ~files[G]; +void doMove(Move move) { + +} + Bitboard maskPawnAttacks(int side, int square) { Bitboard attacks; Bitboard attacker = Bitboard::GetSquare(square); diff --git a/source/movegen.h b/source/movegen.h index 8d59f7c..aa5d68e 100644 --- a/source/movegen.h +++ b/source/movegen.h @@ -1,6 +1,17 @@ #pragma once #include "bitboards.h" +struct Move { +public: + SQUARE moveFrom; + SQUARE moveTo; + + Move(const SQUARE from, const SQUARE to) + : moveFrom(from), moveTo(to) {} +}; + +void doMove(Move move); + // bishop relevant occupancy bit count constexpr int bishopRelevantBits[64] = { 6, 5, 5, 5, 5, 5, 5, 6, diff --git a/source/types.h b/source/types.h index d513720..c70b400 100644 --- a/source/types.h +++ b/source/types.h @@ -20,6 +20,15 @@ enum PIECE { King }; +constexpr std::array PIECE_LETTERS = { + 'P', 'p', + 'N', 'n', + 'B', 'b', + 'R', 'r', + 'Q', 'q', + 'K', 'k' +}; + enum FILES { A, B, C, D, E, F, G, H }; enum RANKS { r_1, r_2, r_3, r_4, r_5, r_6, r_7, r_8 };