MarsExplorer.InstructionsRunner (SWAP - Mars Explorer v0.1.0) View Source
Module responsible for running the exploration instructions
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Run a set of exploration instructions
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Specs
run([ {:grid, %{north: integer(), east: integer()}} | {:place, MarsExplorer.Exploration.placement()} | [:move | :turn_left | :turn_right] ]) :: [MarsExplorer.Exploration.t()]
Run a set of exploration instructions
Example
iex> instructions = [{:grid, %{north: 5, east: 5}}, {:place, %{north: 0, east: 0, direction: :north}}, [:move, :move]]
[{:grid, %{north: 5, east: 5}}, {:place, %{north: 0, east: 0, direction: :north}}, [:move, :move]]
iex> MarsExplorer.InstructionsRunner.run instructions
[
%MarsExplorer.Exploration{
probe: %MarsExplorer.Probe{
north: 2,
east: 0,
direction: :north
},
grid: %MarsExplorer.HighlandGrid{
north_limit: 5,
east_limit: 5
}
}
]