39 lines
901 B
C++
39 lines
901 B
C++
/*
|
|
* File: Board.hpp
|
|
* Author: amr
|
|
*
|
|
* Created on July 30, 2025, 9:20 PM
|
|
*/
|
|
|
|
#ifndef BOARD_HPP
|
|
#define BOARD_HPP
|
|
|
|
#include <vector>
|
|
#include <memory>
|
|
#include <cstdint>
|
|
#include "Piece.hpp"
|
|
|
|
// why do I have to forward declare all these?!
|
|
class Piece;
|
|
enum Players { PL_WHITE, PL_BLACK };
|
|
struct Square;
|
|
|
|
class Board {
|
|
friend class Piece;
|
|
public:
|
|
Board();
|
|
virtual ~Board();
|
|
void setupInitialPosition();
|
|
Piece *getPieceAt(Square square) const;
|
|
void movePiece(Square from, Square to);
|
|
bool isInBounds(Square square) const;
|
|
bool isEmpty(Square square) const;
|
|
uint64_t serialBoard = 0xFFFF00000000FFFF; // opening position
|
|
void deserializeBoard(uint64_t incomingBoard);
|
|
// 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;
|
|
};
|
|
|
|
#endif // BOARD_HPP
|
|
|