chores: updated gitignore, removal of configurations.xml, formatted header
This commit is contained in:
parent
a56fb4d60f
commit
a1560f1611
3 changed files with 36 additions and 875 deletions
|
|
@ -32,15 +32,15 @@ class Board {
|
|||
return boardGrid[r][f];
|
||||
}
|
||||
|
||||
const std::unique_ptr<Piece>& at(int r, int f) const {
|
||||
const std::unique_ptr<Piece> &at(int r, int f) const {
|
||||
return boardGrid[r][f];
|
||||
}
|
||||
|
||||
std::unique_ptr<Piece>& at(const Square& sq) {
|
||||
std::unique_ptr<Piece> &at(const Square& sq) {
|
||||
return boardGrid[static_cast<int>(sq.rank)][static_cast<int>(sq.file)];
|
||||
}
|
||||
|
||||
const std::unique_ptr<Piece>& at(const Square& sq) const {
|
||||
const std::unique_ptr<Piece> &at(const Square& sq) const {
|
||||
return boardGrid[static_cast<int>(sq.rank)][static_cast<int>(sq.file)];
|
||||
}
|
||||
public:
|
||||
|
|
@ -49,23 +49,43 @@ class Board {
|
|||
|
||||
// These are to allow Piece to access Board in a controlled way
|
||||
// ----- Getters -----
|
||||
Piece* getPieceAt(int r, int f) { return at(r, f).get(); }
|
||||
const Piece* getPieceAt(int r, int f) const { return at(r, f).get(); }
|
||||
Piece* getPieceAt(int r, int f) {
|
||||
return at(r, f).get();
|
||||
}
|
||||
const Piece* getPieceAt(int r, int f) const {
|
||||
return at(r, f).get();
|
||||
}
|
||||
|
||||
Piece* getPieceAt(const Square& sq) { return at(sq).get(); }
|
||||
const Piece* getPieceAt(const Square& sq) const { return at(sq).get(); }
|
||||
Piece* getPieceAt(const Square& sq) {
|
||||
return at(sq).get();
|
||||
}
|
||||
const Piece* getPieceAt(const Square& sq) const {
|
||||
return at(sq).get();
|
||||
}
|
||||
|
||||
// ----- Setters -----
|
||||
void setPieceAt(int r, int f, std::unique_ptr<Piece> piece) { at(r, f) = std::move(piece); }
|
||||
void setPieceAt(const Square& sq, std::unique_ptr<Piece> piece) { at(sq) = std::move(piece); }
|
||||
void setPieceAt(int r, int f, std::unique_ptr<Piece> piece) {
|
||||
at(r, f) = std::move(piece);
|
||||
}
|
||||
void setPieceAt(const Square& sq, std::unique_ptr<Piece> piece) {
|
||||
at(sq) = std::move(piece);
|
||||
}
|
||||
|
||||
void clearSquare(int r, int f) { at(r, f).reset(); }
|
||||
void clearSquare(const Square& sq) { at(sq).reset(); }
|
||||
void clearSquare(int r, int f) {
|
||||
at(r, f).reset();
|
||||
}
|
||||
void clearSquare(const Square& sq) {
|
||||
at(sq).reset();
|
||||
}
|
||||
|
||||
// ----- Utility -----
|
||||
bool isSquareEmpty(int r, int f) const { return at(r, f) == nullptr; }
|
||||
bool isSquareEmpty(const Square& sq) const { return at(sq) == nullptr; }
|
||||
|
||||
bool isSquareEmpty(int r, int f) const {
|
||||
return at(r, f) == nullptr;
|
||||
}
|
||||
bool isSquareEmpty(const Square& sq) const {
|
||||
return at(sq) == nullptr;
|
||||
}
|
||||
|
||||
void setupInitialPosition();
|
||||
|
||||
void clearBoard();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue