TicTacToe.Board (tic_tac_toe v2.0.0) View Source

Functions for interacting with a board.

Link to this section Summary

Link to this section Types

Specs

player() :: :player1 | :computer

Specs

point() :: {0 | 1 | 2, 0 | 1 | 2}

Specs

position() :: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9

Specs

t() :: triplet(triplet())

Specs

triplet() :: [nil | player()]

Specs

triplet(triple) :: [triple]

Link to this section Functions

Specs

column(t(), position()) :: triplet()

Specs

columns(t()) :: t()

Specs

diagonal(t(), 1 | 2) :: triplet()

Specs

diagonals(t()) :: [triplet()]

Specs

empty_cells(t()) :: [point()]
Link to this function

indexes_from_position(position, board)

View Source

Specs

indexes_from_position(position(), t()) :: point()

Specs

new() :: t()
Link to this function

position_from_indexes(arg, board)

View Source

Specs

position_from_indexes(point(), t()) :: position()
Link to this function

receive_move(board, player, position)

View Source

Specs

receive_move(t(), player(), position()) :: t()

Specs

row(t(), position()) :: triplet()

Specs

rows(t()) :: t()

Specs

size(t()) :: non_neg_integer()

Specs

triplets(t()) :: [triplet()]