home *** CD-ROM | disk | FTP | other *** search
/ Phoenix CD 2.0 / Phoenix_CD.cdr / 01e / lisp211.zip / DRAGON.L next >
Lisp/Scheme  |  1986-04-14  |  1KB  |  40 lines

  1. ;; DRAGON.L FOR PC-LISP V2.10
  2. ;; ~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  3. ;;     Draw an Nth order Dragon Curve requires Turtle.l routines to run.
  4. ;; Taken From Byte April 1986. Try (DragonCurve 16) then put on supper,
  5. ;; watch the news and come back in an hour and see the results. It takes 
  6. ;; about 1/2 hour on my machine so on a normal IBM-PC it should take about
  7. ;; an 1.5 hours.
  8. ;;
  9. ;;              Peter Ashwood-Smith.
  10. ;;              April 1986
  11. ;;
  12. ;;              P.S - This dragon is nicknamed "spot"
  13.  
  14. (load 'turtle)
  15.  
  16. (defun Dragon(sign level)
  17.        (cond  ((zerop level) (TurtleForward Global_Step_Size))
  18.           (t (setq level (1- level))
  19.          (TurtleRight (times 45 sign))
  20.          (Dragon -1 level)
  21.          (TurtleLeft (times 90 sign))
  22.          (Dragon 1 level)
  23.          (TurtleRight (times 45 sign))
  24.           )         
  25.        )
  26. )
  27.  
  28. (defun DragonCurve (n)
  29.        (setq Global_Step_Size 1)                  ; StepSize is global variable
  30.        (TurtleGraphicsUp)
  31.        (TurtleCenter)
  32.        (TurtleGoTo 330 50)
  33.        (TurtleRight 30)                           ; angle the serpent a bit
  34.        (Dragon 1 n)
  35.        (gc)
  36. )
  37.  
  38.     
  39.  
  40.