77 lines
1.5 KiB
C++
77 lines
1.5 KiB
C++
#include "Board.hpp"
|
|
|
|
#include <ostream>
|
|
#include <cassert>
|
|
#include <cmath>
|
|
#include <bitset>
|
|
#include <algorithm>
|
|
|
|
Board::Board() {
|
|
}
|
|
|
|
void Board::setPiece(const Square &square, const Piece::Optional &piece) {
|
|
|
|
auto index = square.index();
|
|
for (auto &item : mPieceBBs) {
|
|
clearIndex(item, index);
|
|
}
|
|
|
|
setIndex(mPieceBBs[piece->typeVal() + piece->colorVal()], index);
|
|
}
|
|
|
|
Piece::Optional Board::piece(const Square &square) const {
|
|
int i = 0;
|
|
BitBoard mask = indexToBitBoard(square.index());
|
|
for (const auto &kPieceBb : mPieceBBs) {
|
|
if (kPieceBb & mask) {
|
|
return Piece(indexToColor(i), indexToType(i));
|
|
}
|
|
|
|
i++;
|
|
}
|
|
return std::nullopt;
|
|
}
|
|
|
|
void Board::setTurn(PieceColor turn) {
|
|
mTurn = turn;
|
|
}
|
|
|
|
PieceColor Board::turn() const {
|
|
return mTurn;
|
|
}
|
|
|
|
void Board::setCastlingRights(CastlingRights cr) {
|
|
(void) cr;
|
|
}
|
|
|
|
CastlingRights Board::castlingRights() const {
|
|
return CastlingRights::None;
|
|
}
|
|
|
|
void Board::setEnPassantSquare(const Square::Optional &square) {
|
|
(void) square;
|
|
}
|
|
|
|
Square::Optional Board::enPassantSquare() const {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void Board::makeMove(const Move &move) {
|
|
(void) move;
|
|
}
|
|
|
|
void Board::pseudoLegalMoves(MoveVec &moves) const {
|
|
(void) moves;
|
|
}
|
|
|
|
void Board::pseudoLegalMovesFrom(const Square &from,
|
|
Board::MoveVec &moves) const {
|
|
(void) from;
|
|
(void) moves;
|
|
}
|
|
|
|
std::ostream &operator<<(std::ostream &os, const Board &board) {
|
|
(void) board;
|
|
return os;
|
|
}
|