Added moveList to Board class + some helper functions
This commit is contained in:
1 parent
d0d7af4a79
commit
076ce9b904
4 files changed
+24
-4
No files matched your search
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,12 @@
|
||||
#include <array>
|
||||
#include "bitboards.h"
|
||||
#include "types.h"
|
||||
#include "movegen.h"
|
||||
#include <vector>
|
||||
|
||||
class Board {
|
||||
private:
|
||||
std::vector<Move> moveList;
|
||||
public:
|
||||
std::array<Bitboard, 6> pieces;
|
||||
std::array<Bitboard, 2> colors;
|
||||
@@ -13,6 +17,8 @@ public:
|
||||
int halfMoves = 0;
|
||||
int fullMoves = 0;
|
||||
|
||||
Move lastMove;
|
||||
|
||||
std::array<bool, 4> 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();
|
||||
};
|
||||
+2
-2
@@ -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) {
|
||||
|
||||
+4
-2
@@ -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] = {
|
||||
|
||||
Reference in new issue
Block a user