dev: Pile of updates and formatting fixes.

This commit is contained in:
A.M. Rowsell 2025-08-25 16:04:25 -04:00
commit 68ed9ce922
Signed by untrusted user who does not match committer: amr
GPG key ID: E0879EDBDB0CA7B1
9 changed files with 182 additions and 166 deletions

View file

@ -1,10 +1,10 @@
// © 2025 A.M. Rowsell <amr@frzn.dev>
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// This Source Code Form is "Incompatible With Secondary Licenses", as
// defined by the Mozilla Public License, v. 2.0.
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// This Source Code Form is "Incompatible With Secondary Licenses", as
// defined by the Mozilla Public License, v. 2.0.
#ifndef PIECE_HPP
#define PIECE_HPP
@ -12,6 +12,7 @@
#include <cstdint>
#include <utility>
#include <string>
#include <memory>
#include <vector>
#include "Board.hpp"
@ -48,15 +49,16 @@ struct Move {
};
class Piece {
private:
friend class Board;
protected:
protected:
PieceColour colour;
PieceType pieceType;
std::string pieceName;
char pieceSymbol;
char pieceSymbol;
bool hasMoved = false;
public:
public:
Piece(PieceColour pColour) : colour(pColour) {
}
@ -66,15 +68,15 @@ public:
PieceColour getColour() const {
return colour;
}
std::string getPieceName() const {
return pieceName;
}
char getPieceSymbol() const {
return pieceSymbol;
}
PieceType getPieceType() const {
return pieceType;
}
@ -86,7 +88,7 @@ public:
class King : public Piece {
friend class Board;
public:
public:
King(PieceColour colour) : Piece(colour) {
pieceName = "King";
@ -102,14 +104,14 @@ public:
bool checkForCastle() const {
return canCastle;
}
protected:
protected:
bool canCastle = true;
bool inCheck = false;
};
class Rook : public Piece {
friend class Board;
public:
public:
Rook(PieceColour colour) : Piece(colour) {
pieceName = "Rook";
@ -121,7 +123,7 @@ public:
class Queen : public Piece {
friend class Board;
public:
public:
Queen(PieceColour colour) : Piece(colour) {
pieceName = "Queen";
@ -133,7 +135,7 @@ public:
class Knight : public Piece {
friend class Board;
public:
public:
Knight(PieceColour colour) : Piece(colour) {
pieceName = "Knight";
@ -145,7 +147,7 @@ public:
class Bishop : public Piece {
friend class Board;
public:
public:
Bishop(PieceColour colour) : Piece(colour) {
pieceName = "Bishop";
@ -157,7 +159,7 @@ public:
class Pawn : public Piece {
friend class Board;
public:
public:
Pawn(PieceColour colour) : Piece(colour) {
pieceName = "Pawn";