View Source Islands.Board.Cache (Islands Board Cache v0.1.27)

Board Cache for the Game of Islands. Returns a random board.

Inspired by the book Functional Web Development by Lance Halvorsen.
But mostly inspired by the course Multi-Player Bingo by Mike and Nicole Clark.

Link to this section Summary

Functions

Returns the number of boards in the cache.

Returns a random board.

Link to this section Functions

Specs

board_count() :: pos_integer()

Returns the number of boards in the cache.

Examples

iex> alias Islands.Board.Cache
iex> Cache.board_count()
99

Specs

get_board() :: Islands.Board.t()

Returns a random board.

Examples

iex> alias Islands.Board.Cache
iex> alias Islands.Board
iex> %Board{islands: islands, misses: misses} = Cache.get_board()
iex> {map_size(islands), MapSet.size(misses)}
{5, 0}