Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
The Heighway dragon (also known as the Harter–Heighway dragon or the Jurassic Park dragon) was first investigated by NASA physicists John Heighway, Bruce Banks, and William Harter. It was described by Martin Gardner in his Scientific American column Mathematical Games in 1967. It is a self-similar fractal curve, which can be approximated by recu…
(ns lindenmayer-systems.demo
(:use [turtle.core :only [draw!]]
[turtle.renderer.canvas :only [->canvas]]
[enchilada :only [ctx canvas]]
[jayq.core :only [show]]))
(def dragon-seq
"Unfolding the dragon"
(letfn [(seq0 [x y]
(lazy-seq (cons (flatten x) (seq0 [x :right 90 y :fwd 20] [:fwd 20 x :left 90 y]))))]
(seq0 [] [])))
(show canvas)
(draw! (->canvas ctx) (nth dragon-seq 13) [800 600])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.