UnblockMeSolver v1.0.0 UnblockMeSolver View Source
UnblockMeSolver is a solver for the UnblockMe mobile puzzle game.
This module to generate and solve UnblockMe problems. UnblockMeSolver generates and solves UnblockMe problems in various configurations
For example, to generate a trivial problem:
iex> UnblockMeSolver.generate(:trivial)
[
[nil, nil, nil, nil, nil],
[nil, nil, nil, nil, nil],
['A', 'A', nil, nil, nil],
[nil, nil, nil, nil, nil],
[nil, nil, nil, nil, nil]
]
Then solving the problem:
iex> UnblockMeSolver.generate(:trivial) |> UnblockMeSolver.solve()
[
{'A', :right, 1},
{'A', :right, 1},
{'A', :right, 1},
]
Link to this section Summary
Functions
Generates problems solvable by the UnblockMeSolver.solve/1
function.
Solves an UnblockMe problem generated from UnblockMeSolver.generate/1
and returns a list of moves to solve the problem
Link to this section Functions
Generates problems solvable by the UnblockMeSolver.solve/1
function.
Examples
iex> UnblockMeSolver.generate(:trivial)
[
[nil, nil, nil, nil, nil],
[nil, nil, nil, nil, nil],
['A', 'A', nil, nil, nil],
[nil, nil, nil, nil, nil],
[nil, nil, nil, nil, nil]
]
The first argument specifies the difficulty. Accepted inputs are:
- :trivial - A problem with no other blocks. Ideal for testing
- :simple - A problem with 1 other block. Ideal for a demo
Another other input will raise an error
Solves an UnblockMe problem generated from UnblockMeSolver.generate/1
and returns a list of moves to solve the problem
Examples
iex> UnblockMeSolver.generate(:trivial) |> UnblockMeSolver.solve()
[
{'A', :right, 1},
{'A', :right, 1},
{'A', :right, 1},
]