dev: Updates to Board and Piece, formatted code
This commit is contained in:
parent
8e381cf109
commit
f05dd6d90f
6 changed files with 122 additions and 121 deletions
|
|
@ -13,7 +13,6 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
#include "Piece.hpp"
|
||||
|
||||
|
|
@ -24,24 +23,28 @@ enum Players { PL_WHITE, PL_BLACK };
|
|||
struct Square;
|
||||
|
||||
class Board {
|
||||
private:
|
||||
friend class Piece;
|
||||
Players playerTurn;
|
||||
public:
|
||||
// this should be protected, but even when Piece is declared as a friend,
|
||||
// accessing it in Piece.cpp threw an error
|
||||
std::vector<std::vector<std::unique_ptr<Piece>>> boardGrid;
|
||||
Board();
|
||||
virtual ~Board();
|
||||
|
||||
void setupInitialPosition();
|
||||
std::unique_ptr<Piece> &getPieceAt(Square square);
|
||||
void movePiece(Square from, Square to);
|
||||
int setupFromFEN(std::string strFEN);
|
||||
bool isInBounds(Square square) const;
|
||||
bool isEmpty(Square square) const;
|
||||
uint64_t serialBoard = 0xFFFF00000000FFFF; // opening position
|
||||
void deserializeBoard(uint64_t incomingBoard);
|
||||
private:
|
||||
friend class Piece; // this doesn't seem to do anything
|
||||
Players playerTurn;
|
||||
public:
|
||||
// this should be protected, but even when Piece is declared as a friend,
|
||||
// accessing it in Piece.cpp threw an error
|
||||
std::vector<std::vector<std::unique_ptr<Piece>>> boardGrid;
|
||||
Board();
|
||||
virtual ~Board();
|
||||
|
||||
void setupInitialPosition();
|
||||
|
||||
void clearBoard();
|
||||
std::unique_ptr<Piece> &getPieceAt(Square square);
|
||||
void movePiece(Square from, Square to);
|
||||
void nextTurn();
|
||||
int setupFromFEN(std::string strFEN);
|
||||
bool isInBounds(Square square) const;
|
||||
bool isEmpty(Square square) const;
|
||||
// serial shift register stuff
|
||||
uint64_t serialBoard = 0xFFFF00000000FFFF; // opening position
|
||||
void deserializeBoard(uint64_t incomingBoard);
|
||||
};
|
||||
|
||||
#endif // BOARD_HPP
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue