fix goto! error
This commit is contained in:
parent
9584a21521
commit
5a27d345eb
|
@ -1271,7 +1271,7 @@ fn heading/vector {
|
||||||
fn apply_command {
|
fn apply_command {
|
||||||
"Takes a turtle state and a command and calculates a new state."
|
"Takes a turtle state and a command and calculates a new state."
|
||||||
(state, command) -> match command with {
|
(state, command) -> match command with {
|
||||||
(:goto, (x, y)) -> assoc (state, :position, (x, y))
|
(:goto, (x, y)) -> assoc (state, :position, (neg (x), y))
|
||||||
(:home) -> assoc (state, :position, (0, 0))
|
(:home) -> assoc (state, :position, (0, 0))
|
||||||
(:clear) -> assoc (state, :position, (0, 0))
|
(:clear) -> assoc (state, :position, (0, 0))
|
||||||
(:right, turns) -> update (state, :heading, add (_, turns))
|
(:right, turns) -> update (state, :heading, add (_, turns))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user