ludus-scripts/10print.ld

65 lines
961 B
Plaintext
Raw Normal View History

penup! ()
goto! (150, 150) & should be (-150, -150)
right! (0.25)
let root_2 = 1.414213562
let cell_size = 15
let line_length = mult (root_2, cell_size)
fn upstroke! () -> {
print! (:up)
penup! ()
forward! (cell_size)
left! (0.125)
pendown! ()
back! (line_length)
penup! ()
forward! (line_length)
right! (0.125)
}
fn downstroke! () -> {
print! (:down)
pendown! ()
right! (0.125)
forward! (line_length)
left! (0.375)
penup! ()
forward! (cell_size)
right! (0.25)
}
fn up_or_down! () -> {
let rand = random ()
if lt? (rand, 0.5)
then upstroke! ()
else downstroke! ()
}
fn newline! () -> {
penup! ()
back! (mult (grid_size, cell_size))
right! (0.25)
forward! (cell_size)
left! (0.25)
}
let grid_size = 20
fn randcolor! () -> pencolor! ((random (0, 255), random (0, 255), random (0, 255)))
repeat grid_size {
randcolor! ()
up_or_down! ()
}
& repeat grid_size {
& newline! ()
& }