View Source Hanoi.Board (Towers of Hanoi v1.0.0)

The domain model.

The type and functions that define and create the domain data model

Summary

Types

t()

A hanoi board formed of three piles of stones.

Functions

Recommended way to set up the inital board with stones on left

Generally used by test code, set up stack of stones. You are required to set up your own board still.

Returns true if the game is complete. That is all the stones are on the right pile in correct order

Types

@type t() :: %Hanoi.Board{centre: list(), left: list(), right: list()}

A hanoi board formed of three piles of stones.

Functions

@spec create_board(stones :: pos_integer()) :: t()

Recommended way to set up the inital board with stones on left

Link to this function

create_loaded_stack(stones)

View Source
@spec create_loaded_stack(stones :: pos_integer()) :: list()

Generally used by test code, set up stack of stones. You are required to set up your own board still.

Link to this function

is_complete(board, stones)

View Source
@spec is_complete(board :: t(), stones :: pos_integer()) :: boolean()

Returns true if the game is complete. That is all the stones are on the right pile in correct order