Compare commits
No commits in common. "70e8b1ede8ffff8c718fb4ecb7e258eec124d587" and "fe5b196404fd29be7ae02165df3be8d53add1e03" have entirely different histories.
70e8b1ede8
...
fe5b196404
19
prelude.ld
19
prelude.ld
|
@ -1111,8 +1111,7 @@ fn render_turtle! () -> {
|
|||
add_call! ((:fill, r, g, b, a))
|
||||
let #{heading
|
||||
:pencolor (pen_r, pen_g, pen_b, pen_a)
|
||||
:position (x, y)
|
||||
pendown?
|
||||
:position (x, y)
|
||||
...} = state
|
||||
let first = mult ((0, 1), turtle_radius)
|
||||
let (x1, y1) = first
|
||||
|
@ -1129,7 +1128,7 @@ fn render_turtle! () -> {
|
|||
add_call! ((:endShape))
|
||||
& there's a happy bug here: the stroke will be the same width as the pen width. Keep this for now. Consider also showing the pen colour here?
|
||||
add_call! ((:stroke, pen_r, pen_g, pen_b, pen_a))
|
||||
if pendown? then add_call! ((:line, 0, 0, x1, y1)) else nil
|
||||
add_call! ((:line, 0, 0, x1, y1))
|
||||
add_call! ((:pop))
|
||||
:ok
|
||||
}
|
||||
|
@ -1252,16 +1251,6 @@ fn setheading! {
|
|||
(heading as :number) -> add_command! ((:setheading, heading))
|
||||
}
|
||||
|
||||
fn showturtle! {
|
||||
"If the turtle is hidden, shows the turtle. If the turtle is already visible, does nothing."
|
||||
() -> add_command! ((:show))
|
||||
}
|
||||
|
||||
fn hideturtle! {
|
||||
"If the turtle is visible, hides it. If the turtle is already hidden, does nothing."
|
||||
() -> add_command! ((:hide))
|
||||
}
|
||||
|
||||
fn heading/vector {
|
||||
"Takes a turtle heading, and returns a unit vector of that heading."
|
||||
(heading) -> {
|
||||
|
@ -1298,8 +1287,6 @@ fn apply_command {
|
|||
(:penwidth, pixels) -> assoc (state, :penwidth, pixels)
|
||||
(:pencolor, color) -> assoc (state, :pencolor, color)
|
||||
(:setheading, heading) -> assoc (state, :heading, heading)
|
||||
(:show) -> assoc (state, :visible?, true)
|
||||
(:hide) -> assoc (state, :visible?, false)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1408,7 +1395,6 @@ pkg Prelude {
|
|||
gte? & math
|
||||
heading & turtles
|
||||
heading/vector & math
|
||||
hideturtle! & turtles
|
||||
home! & turtles
|
||||
inc & math
|
||||
inv & math
|
||||
|
@ -1478,7 +1464,6 @@ pkg Prelude {
|
|||
set? & sets
|
||||
setheading! & turtles
|
||||
show & strings
|
||||
showturtle! & turtles
|
||||
sin & math
|
||||
slice & lists tuples strings
|
||||
some & values
|
||||
|
|
|
@ -52,11 +52,7 @@
|
|||
(comment
|
||||
# (do
|
||||
(def source `
|
||||
hideturtle! ()
|
||||
showturtle! ()
|
||||
penup! ()
|
||||
pendown! ()
|
||||
pencolor! (colors :red)
|
||||
butlast ([1, 2, 3])
|
||||
`)
|
||||
(def out (-> source
|
||||
ludus
|
||||
|
|
Loading…
Reference in New Issue
Block a user