rp-scrabble
Simple, terminal-based Scrabble game
|
#include <board.h>
Public Member Functions | |
Board () | |
~Board () | |
Square * | getSquare (int r, int c) |
void | show () |
bool | placeTile (Tile *t, int r, int c) |
void | placeTileStr (Rack *rack, std::vector< Tile * > tilesInStr, int r, int c, char dir) |
Tile * | retrieve (int r, int c) |
Private Attributes | |
Square * | board [NUM_ROWS][NUM_COLS] |
std::array< std::string, 5 > | sqStrings |
Implements the Scrabble board
The board is a 2D matrix of pointers to Square objects
Board::Board | ( | ) |
Board constructor. Fills the 2D board matrix with pointers to Square objects of approproate type. Symmetry of the board is used to easily construct the board. It is done in 2 steps- four square portions and then the 4 strips
Definition at line 18 of file board.cc.
Square * Board::getSquare | ( | int | r, |
int | c | ||
) |
bool Board::placeTile | ( | Tile * | t, |
int | r, | ||
int | c | ||
) |
t | Pointer to the tile to be placed |
r | Row where the tile should be placed |
c | Column where the tile should be placed |
std::string | containing the error message |
Definition at line 213 of file board.cc.
Place a series of Tiles on the Board
rack | Pointer to the Rack from where the Tiles are coming |
tilesInStr | A vector of pointers to the Tiles to be placed |
r | Row where the first Tile goes |
c | Column where the first Tile goes |
dir | Direction of placement ('h'/'v') |
std::string | containing the error message |
Definition at line 246 of file board.cc.
Tile * Board::retrieve | ( | int | r, |
int | c | ||
) |
void Board::show | ( | ) |