diff --git a/assets/prelude.ld b/assets/prelude.ld index 8669db9..03ce4ae 100644 --- a/assets/prelude.ld +++ b/assets/prelude.ld @@ -1299,7 +1299,11 @@ let pd! = pendown! fn pencolor! { "Changes the turtle's pen color. Takes a single grayscale value, an rgb tuple, or an rgba tuple. Alias: `pencolour!`, `pc!`" - (color as :keyword) -> add_command! (:turtle_0, (:pencolor, color)) + (color as :keyword) -> { + if color (colors) + then add_command! (:turtle_0, (:pencolor, color)) + else panic! ("There is no color named {color} in the colors dict.") + } (gray as :number) -> add_command! (:turtle_0, (:pencolor, (gray, gray, gray, 255))) ((r as :number, g as :number, b as :number)) -> add_command! (:turtle_0, (:pencolor, (r, g, b, 255))) ((r as :number, g as :number, b as :number, a as :number)) -> add_command! (:turtle_0, (:pencolor, (r, g, b, a))) @@ -1368,16 +1372,29 @@ fn loadstate! { fn turtle_listener () -> { receive { (:forward!, steps as :number) -> add_command! (self (), (:forward, steps)) + (:fd!, steps as :number) -> add_command! (self (), (:forward, steps)) (:back!, steps as :number) -> add_command! (self (), (:back, steps)) + (:bk!, steps as :number) -> add_command! (self (), (:back, steps)) (:left!, turns as :number) -> add_command! (self (), (:left, turns)) + (:lt!, turns as :number) -> add_command! (self (), (:left, turns)) (:right!, turns as :number) -> add_command! (self (), (:right, turns)) + (:rt!, turns as :number) -> add_command! (self (), (:right, turns)) (:penup!) -> add_command! (self (), (:penup)) + (:pu!) -> add_command! (self (), (:penup)) (:pendown!) -> add_command! (self (), (:pendown)) - (:pencolor!, color as :keyword) -> add_command! (self (), (:pencolor, color)) + (:pd!) -> add_command! (self (), (:pendown)) + (:pencolor!, color as :keyword) -> if color (colors) + then add_command! (self (), (:pencolor, color)) + else panic! ("There is no color {color} in the colors dict.") (:pencolor!, gray as :number) -> add_command! (self (), (:pencolor, (gray, gray, gray, 255))) (:pencolor!, (r as :number, g as :number, b as :number)) -> add_command! (self (), (:pencolor, (r, g, b, 255))) (:pencolor!, (r as :number, g as :number, b as :number, a as :number)) -> add_command! (self (), (:pencolor, (r, g, b, a))) + (:pc!, color as :keyword) -> add_command! (self (), (:pencolor, color)) + (:pc!, gray as :number) -> add_command! (self (), (:pencolor, (gray, gray, gray, 255))) + (:pc!, (r as :number, g as :number, b as :number)) -> add_command! (self (), (:pencolor, (r, g, b, 255))) + (:pc!, (r as :number, g as :number, b as :number, a as :number)) -> add_command! (self (), (:pencolor, (r, g, b, a))) (:penwidth!, width as :number) -> add_command! (self (), (:penwidth, width)) + (:pw!, width as :number) -> add_command! (self (), (:penwidth, width)) (:home!) -> add_command! (self (), (:home)) (:goto!, x as :number, y as :number) -> add_command! (self (), (:goto, (x, y))) (:goto!, (x as :number, y as :number)) -> add_command! (self (), (:goto, (x, y)))