31 lines
612 B
Plaintext
31 lines
612 B
Plaintext
& Example Ludus implementation of the Dragon curve.
|
||
& https://en.m.wikipedia.org/wiki/L-system#Example_4:_Koch_curve
|
||
|
||
& A variant of the Koch curve which uses only right angles.
|
||
& variables : F
|
||
& constants : + −
|
||
& start : F
|
||
& rules : (F -> F+F−F−F+F)
|
||
& Here, F means "draw forward", + means "turn left 90°", and − means "turn right 90°"
|
||
|
||
|
||
let length = 10
|
||
let angle = 0.25
|
||
|
||
fn koch! {
|
||
(0) -> fd! (length)
|
||
(n) -> {
|
||
koch! (dec (n))
|
||
lt! (angle)
|
||
koch! (dec (n))
|
||
rt! (angle)
|
||
koch! (dec (n))
|
||
rt! (angle)
|
||
koch! (dec (n))
|
||
lt! (angle)
|
||
koch! (dec (n))
|
||
}
|
||
}
|
||
|
||
& koch! (3)
|