Guest User

Untitled

a guest
Jan 20th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. load-file "turtle.clj")
  2. (in-ns 'turtle)
  3.  
  4. (defn boom [turtle len depth]
  5. (loop [i 0]
  6. (if (= i 0)
  7. (forward turtle len))
  8. (:else
  9. (forward turtle (* i 0.8 len)))
  10.  
  11. (if (> depth 1)
  12. (do (left turtle 80)
  13. (boom turtle (- depth 1))
  14. (right turtle 160)
  15. (boom turtle (- depth 1))
  16. (left turtle 80)))
  17. (if (= i 0)
  18. (back turtle len))
  19. (:else
  20. (back turtle (* i 0.8 len)))
  21. (recur (inc i))))
  22.  
  23.  
  24. (let [turtle (turtle 400 400)]
  25. (pen-up turtle)
  26. (go turtle 0 -100)
  27. (pen-down turtle)
  28. (boom turtle 10 5)
  29. (show turtle))
Add Comment
Please, Sign In to add comment