Whisk (Whisk v0.2.0) View Source

The scrambler.

Link to this section Summary

Types

A string representation of a puzzle type.

A scramble is string representing a sequence of moves, separated by spaces.

Functions

Returns a list of supported puzzle types.

Generate a scramble for a puzzle type. Also accepts the puzzle type as a string.

Link to this section Types

Specs

puzzle_type() :: atom()

A string representation of a puzzle type.

See puzzle_types/0 for supported values.

Specs

scramble() :: String.t()

A scramble is string representing a sequence of moves, separated by spaces.

Moves are also strings. Different puzzle types have different valid moves.

Link to this section Functions

Specs

puzzle_types() :: [atom()]

Returns a list of supported puzzle types.

iex> Whisk.puzzle_types()
[:"2x2", :"3x3", :"3x3 OH", :"3x3 BLD", :"4x4", :"5x5", :"6x6", :"7x7", :Skewb, :Pyraminx, :Megaminx]
Link to this function

scramble(puzzle_name, opts \\ [])

View Source

Specs

scramble(puzzle_type() | String.t(), list()) :: scramble()

Generate a scramble for a puzzle type. Also accepts the puzzle type as a string.

Passing an unsupported puzzle type will generate an error.

Options

  • :length - the number of moves in the scramble
  • :reps - for puzzles with repeating patterns, like Megaminx, specify the number of repetitions

Examples

iex> Whisk.scramble(:"3x3")
"L F2 U R D B U2 R F' R F R2 D2 B R' B' D R B U"

iex> Whisk.scramble(:"Skewb", length: 12)
"L R B' R U' R' B L' U' B' L R U' R' L'"

iex> Whisk.scramble(:Megaminx, length: 5, reps: 3)
"D-- R-- D++ R-- D++ U' D++ R-- D++ R-- D++ U R-- D-- R-- D-- R++ U"