fix goto! error

This commit is contained in:
Scott Richmond 2024-06-14 15:43:52 -04:00
parent 9584a21521
commit 5a27d345eb

View File

@ -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))