Documentation
¶
Overview ¶
Package board stores the tiles for a game and handles queries to read and update tiles
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Board ¶
type Board struct { UnusedTiles map[tile.ID]tile.Tile UnusedTileIDs []tile.ID UsedTiles map[tile.ID]tile.Position UsedTileLocs map[tile.X]map[tile.Y]tile.Tile NumRows int NumCols int }
Board represents the positioning of a player's tiles from a game. (Each player has their own board)
func (*Board) AddTile ¶
AddTile adds a tile to the board's unused tiles. An error is returned and the tile is not added if the player already has it.
func (Board) CanMoveTiles ¶
CanMoveTiles determines if the player's tiles can be moved to/in the used area without overlapping any other tiles
func (*Board) HasSingleUsedGroup ¶
HasSingleUsedGroup determines if the player's tiles form a single group, with all tiles connected via immediate horizontal and vertical neighbors
func (*Board) MoveTiles ¶
MoveTiles moves the tiles to the specified positions. No action is taken and an error is returned if the tiles cannot be moved.
func (*Board) RemoveTile ¶
RemoveTile removes a single tile from the board's tiles. An error is returned if the board does not have the tile.
func (Board) UsedTileWords ¶
UsedTileWords computes all the horizontal and vertical words formed by used tiles.