44 std::weak_ptr<Piece>
move(
RoleID role, std::weak_ptr<Piece> gamePiece, glm::u8vec2 toLocation, uint8_t roll);
73 bool canMove(
RoleID role,
const Piece& gamePiece, glm::u8vec2 toLocation, uint8_t roll)
const;
189 bool isRosette(glm::u8vec2 location)
const;
214 std::array<std::vector<House>, 3>
mGrid {{
216 House{{1, 0}, House::ROSETTE, House::BLACK},
217 House{{0, -1}, House::REGULAR, House::BLACK},
218 House{{0, -1}, House::REGULAR, House::BLACK},
219 House{{0, -1}, House::REGULAR, House::BLACK},
222 House{{0, 1}, House::REGULAR, House::BATTLEFIELD},
223 House{{0, 1}, House::REGULAR, House::BATTLEFIELD},
224 House{{0, 1}, House::REGULAR, House::BATTLEFIELD},
225 House{{0, 1}, House::ROSETTE, House::BATTLEFIELD},
226 House{{0, 1}, House::REGULAR, House::BATTLEFIELD},
227 House{{0, 1}, House::REGULAR, House::BATTLEFIELD},
228 House{{0, 1}, House::REGULAR, House::BATTLEFIELD},
229 House{{0, 1}, House::ROSETTE, House::BATTLEFIELD},
230 House{{0, 1}, House::REGULAR, House::BATTLEFIELD},
231 House{{0, 1}, House::REGULAR, House::BATTLEFIELD},
232 House{{0, 1}, House::REGULAR, House::BATTLEFIELD},
233 House{{0, 1}, House::ROSETTE, House::BATTLEFIELD},
236 House{{-1, 0}, House::ROSETTE, House::WHITE},
237 House{{0, -1}, House::REGULAR, House::WHITE},
238 House{{0, -1}, House::REGULAR, House::WHITE},
239 House{{0, -1}, House::REGULAR, House::WHITE},
The data model class representing the 20-square board for Game of Ur.
Definition board.hpp:29
PieceIdentity getOccupant(glm::u8vec2 location) const
Gets the identity of the piece occupying the house at a given board location.
Definition board.cpp:173
House::Type getType(glm::u8vec2 location) const
Gets the type of the house at a board location.
Definition board.cpp:163
bool canMove(RoleID role, const Piece &gamePiece, glm::u8vec2 toLocation, uint8_t roll) const
Tests whether a given move is possible, per the state of the board.
Definition board.cpp:53
std::weak_ptr< Piece > move(RoleID role, std::weak_ptr< Piece > gamePiece, glm::u8vec2 toLocation, uint8_t roll)
Applies a move after validating it.
Definition board.cpp:4
bool isRosette(glm::u8vec2 location) const
Tests whether the house at a given location is a Rosette house.
Definition board.cpp:46
House::Region getRegion(glm::u8vec2 location) const
Gets the region of the house at a board location.
Definition board.cpp:168
bool isValidHouse(glm::u8vec2 location) const
Tests whether a location corresponds to a real house on the game board.
Definition board.cpp:40
bool isRouteEnd(glm::u8vec2 location) const
Tests whether this location corresponds with what this board considers the end of the route (i....
Definition board.cpp:49
bool movePassesRosette(const Piece &gamePiece, glm::u8vec2 toLocation) const
Tests whether a move, if made, will pass over a rosette without landing on it.
Definition board.cpp:80
glm::i8vec2 getNextCellDirection(glm::u8vec2 location) const
Gets the 2-component vector denoting the step to the next house in the game route,...
Definition board.cpp:201
std::array< std::vector< House >, 3 > mGrid
A list of vectors, where each element in a vector corresponds to one house on the board.
Definition board.hpp:214
bool isValidLaunchHouse(glm::u8vec2 location, const Piece &gamePiece) const
Tests whether the house corresponding to a location is a valid launch house for a given piece.
Definition board.cpp:131
std::vector< glm::u8vec2 > getLaunchPositions(PieceIdentity pieceIdentity) const
Gets a list of launch positions available to different pieces.
Definition board.cpp:178
glm::u8vec2 getLaunchPosition(PieceTypeID pieceType) const
Given a (non-swallow) piece type, gets the location of its launch house.
Definition board.cpp:206
glm::u8vec2 computeMoveLocation(const Piece &gamePiece, uint8_t roll) const
Given a game piece present on the board and a dice roll, computes the new board location for that pie...
Definition board.cpp:106
bool houseIsOccupied(glm::u8vec2 location) const
Tests whether the house at a given location is occupied.
Definition board.cpp:156
std::weak_ptr< Piece > getOccupantReference(glm::u8vec2 location)
Fetches a reference to the piece currently occupying a house pointed to by location.
Definition board.cpp:35
bool moveDisplacesOpponent(RoleID role, const Piece &gamePiece, glm::u8vec2 toLocation, uint8_t roll) const
Tests whether a move will cause an opponent piece to be knocked off the board.
Definition board.cpp:98
The representation of a single house on the Game of Ur Board, in other words a tile.
Definition house.hpp:29
Type
The type of a house.
Definition house.hpp:35
Region
The region this house belongs to.
Definition house.hpp:44
The state of a single piece of the game.
Definition piece.hpp:52
PieceTypeID
Enum listing the different types of pieces present in the game.
Definition piece_type_id.hpp:22
RoleID
A value representing the various roles (or sets, if preferred) possible in this game.
Definition role_id.hpp:20
Contains classes and enums that define a house and describe its state.
Data uniquely identifying a piece used in the game.
Definition piece.hpp:29