View Source Islands.Board.Cache (Islands Board Cache v0.1.36)
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.
Summary
Functions
@spec board_count() :: pos_integer()
Returns the number of boards in the cache.
Examples
iex> alias Islands.Board.Cache
iex> Cache.board_count()
99
@spec 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}