chores: updated gitignore, removal of configurations.xml, formatted header

This commit is contained in:
A.M. Rowsell 2025-09-13 11:36:53 -04:00
commit a1560f1611
Signed by untrusted user who does not match committer: amr
GPG key ID: E0879EDBDB0CA7B1
3 changed files with 36 additions and 875 deletions

View file

@ -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();