Snek v0.2.0 Snek.Board.Size View Source

A struct representing the size of a game board.

A board is always rectangular (or square), and is represented by a width and a height.

Arbitrary board sizes may be created with new/2.

There are some helpers functions for some suggested board sizes, including small/0, medium/0, and large/0. These suggestions are based on the default board sizes in Battlesnake.

Link to this section Summary

Functions

Return a large (19x19) board size.

Return a medium (11x11) board size.

Returns a board size of the specified width and height.

Return a small (7x7) board size.

Link to this section Types

Specs

t() :: %Snek.Board.Size{height: non_neg_integer(), width: non_neg_integer()}

Link to this section Functions

Specs

large() :: t()

Return a large (19x19) board size.

Examples

iex> Size.large
%Size{width: 19, height: 19}

Specs

medium() :: t()

Return a medium (11x11) board size.

Examples

iex> Size.medium
%Size{width: 11, height: 11}
Link to this function

new(width, height)

View Source (since 0.1.0)

Specs

Returns a board size of the specified width and height.

Specs

small() :: t()

Return a small (7x7) board size.

Examples

iex> Size.small
%Size{width: 7, height: 7}