ludus-scripts/gons_recur.ld

24 lines
477 B
Plaintext
Raw Normal View History

fn ngon! (sides, size) -> {
repeat sides {
forward! (size)
right! (div (1, sides))
}
:tada!
}
fn randcolor () -> (random (0, 255), random (0, 255), random (0, 255))
fn pen_randcolor! () -> pencolor! (randcolor ())
fn spiral_gonr! {
(iter) -> spiral_gonr! (iter, iter, 30)
(_, 0, _) -> :ok
(iter, times, size) -> {
pen_randcolor! ()
ngon! (4, size)
right! (inv (iter))
spiral_gonr! (iter, dec (times), inc (size))
}
}
spiral_gonr! (100)