Last active
June 3, 2016 17:35
-
-
Save dubek/1bae5835dbdccca970ed571f9694fca3 to your computer and use it in GitHub Desktop.
Logo mal implementation screenshot - step 4 (WIP)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(logo-eval "setbackground 7") | |
(logo-eval "setpencolor 1") | |
(logo-eval "penup setxy 0 -100 pendown") | |
(def! fd (fn* [size] (logo-eval (str "fd " size)))) | |
(def! bk (fn* [size] (logo-eval (str "bk " size)))) | |
(def! lt (fn* [size] (logo-eval (str "lt " size)))) | |
(def! rt (fn* [size] (logo-eval (str "rt " size)))) | |
(def! leaf (fn* [size] (do (fd size) (bk size)))) | |
(def! branch (fn* [size] (do (fd size) (draw-tree size) (bk size)))) | |
(def! two-branches (fn* [size] (do (lt 10) (branch size) (rt 40) (branch size) (lt 30)))) | |
(def! draw-tree (fn* [size] (if (< size 5) (leaf size) (two-branches (/ size 2))))) | |
(draw-tree 250) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment