(FILECREATED "16-May-84 15:42:17" {INDIGO}<LOOPS>RELEASE>1-MAY-84>SIMPLEG.;1 13519  

      changes to:  (VARS t1 t2 t3 t4 t5 t6 t7 t8 TURTLE TurtleArray)
		   (FNS CENTER ComputeTurtleArrayIndex DrawTurtle SetUpTurtleArray CLEARWINDOW 
			EraseTurtle FORWARD JUMP POINT PRETTY2 PRETTY3 TRITRI TURN)

      previous date: "15-SEP-83 13:59:43" {PHYLUM}<DMRUSSELL>SIMPLEG.;24)


(PRETTYCOMPRINT SIMPLEGCOMS)

(RPAQQ SIMPLEGCOMS ((FNS CENTER CLEARWINDOW ComputeTurtleArrayIndex DRAW DrawT DrawTurtle EraseTurtle 
			 FORWARD JUMP POINT PRETTY0 PRETTY1 PRETTY2 PRETTY3 SetUpTurtleArray TREE 
			 TRITRI TURN)
	(FNS CCurve CCurve1)
	(RECORDS LINE TURTLE)
	(BITMAPS t1 t2 t3 t4 t5 t6 t7 t8)
	[VARS TURTLE TurtleArray (TurtleArrow (QUOTE (((0 0 0)
						       (10 0 0))
						      ((7 4 0)
						       (10 0 0))
						      ((7 -4 0)
						       (10 0 0]
	(P (SETQ WINDOW1
		 (CREATEW (create REGION LEFT ← 300 BOTTOM ← 25 WIDTH ← 700 HEIGHT ← 700)
			  
    "                                ------ Turtle Graphics Window ------           July 1,1983 "
			  10))
	   (* This sets up the bit maps for each of the 8 turtles)
	   (SetUpTurtleArray)
	   (SETQ TURTLE
		 (create TURTLE HEADING ← 0 CURRENTX ← 0 CURRENTY ← 0 WINDOW ← WINDOW1 ERASED? ← T))
	   (CENTER)
	   (CLOSEW WINDOW1))))
(DEFINEQ

(CENTER
  [LAMBDA NIL                                                (* dmr: "22-JUL-83 11:47")
                                                             (* Move the TURTLE to the center of the TurtleWindow)
    (replace CURRENTX of TURTLE with (FQUOTIENT (WINDOWPROP (fetch WINDOW of TURTLE)
							    (QUOTE WIDTH))
						2))
    (replace CURRENTY of TURTLE with (FQUOTIENT (WINDOWPROP (fetch WINDOW of TURTLE)
							    (QUOTE HEIGHT))
						2))
    (replace HEADING of TURTLE with 0)
    (DrawTurtle])

(CLEARWINDOW
  [LAMBDA NIL                                                (* dmr: "22-JUL-83 11:47")
    (CLEARW (fetch WINDOW of TURTLE))
    (COND
      ((GREATERP (fetch HEADING of TURTLE)
		 360)
	(replace HEADING of TURTLE with (FDIFFERENCE (fetch HEADING of TURTLE)
						     360])

(ComputeTurtleArrayIndex
  [LAMBDA NIL                                                (* dmr: "27-JUL-83 16:31")
    (COND
      ((LESSP (fetch HEADING of TURTLE)
	      0)
	(replace HEADING of TURTLE with (FPLUS (fetch HEADING of TURTLE)
					       360))
	(ComputeTurtleArrayIndex))
      (T (ADD1 (IQUOTIENT (REMAINDER (fetch HEADING of TURTLE)
				     360)
			  45])

(DRAW
  [LAMBDA (LINELIST WINDOW)                                  (* dmr: "22-JUL-83 11:48")
    (for LINE in LINELIST do (DRAWLINE LINE:X1 LINE:Y1 LINE:X2 LINE:Y2 1 NIL
				       (if TURTLE:WINDOW=NIL
					   then WINDOW1
					 else TURTLE:WINDOW])

(DrawT
  [LAMBDA NIL                                                (* dmr: " 7-JUL-83 14:36")
    (FORWARD 50)
    (TURN 90 (QUOTE RIGHT))
    (FORWARD 50)
    (TURN 90 (QUOTE LEFT))
    (FORWARD 50)
    (TURN 90 (QUOTE LEFT))
    (FORWARD 125)
    (TURN 90 (QUOTE LEFT))
    (FORWARD 50)
    (TURN 90 (QUOTE LEFT))
    (FORWARD 50)
    (TURN 90 (QUOTE RIGHT))
    (FORWARD 50])

(DrawTurtle
  [LAMBDA NIL                                                (* edited: " 3-AUG-83 23:28")
    (replace ERASED? of TURTLE with NIL)
    (BITBLT (ELT TurtleArray (ComputeTurtleArrayIndex))
	    NIL NIL (fetch WINDOW of TURTLE)
	    (DIFFERENCE (fetch CURRENTX of TURTLE)
			12)
	    (DIFFERENCE (fetch CURRENTY of TURTLE)
			12)
	    NIL NIL NIL (QUOTE INVERT)
	    NIL])

(EraseTurtle
  [LAMBDA NIL                                                (* dmr: "27-JUL-83 16:14")
    (PROG NIL
          (COND
	    ((fetch ERASED? of TURTLE)
	      (RETURN)))
          (replace ERASED? of TURTLE with T)
          (BITBLT (ELT TurtleArray (ComputeTurtleArrayIndex))
		  NIL NIL (fetch WINDOW of TURTLE)
		  (DIFFERENCE (fetch CURRENTX of TURTLE)
			      12)
		  (DIFFERENCE (fetch CURRENTY of TURTLE)
			      12)
		  NIL NIL NIL (QUOTE INVERT])

(FORWARD
  [LAMBDA (DISTANCE LINEWIDTH)                               (* dmr: "22-JUL-83 11:50")
    (PROG (nextx nexty)
          [SETQ nextx (FPLUS (fetch CURRENTX of TURTLE)
			     (FTIMES DISTANCE (COS (fetch HEADING of TURTLE]
          [SETQ nexty (FPLUS (fetch CURRENTY of TURTLE)
			     (FTIMES DISTANCE (SIN (fetch HEADING of TURTLE]
          (EraseTurtle)
          (DRAWLINE (fetch CURRENTX of TURTLE)
		    (fetch CURRENTY of TURTLE)
		    nextx nexty (COND
		      ((NULL LINEWIDTH)
			1)
		      (T LINEWIDTH))
		    NIL
		    (fetch WINDOW of TURTLE))
          (replace CURRENTX of TURTLE with nextx)
          (replace CURRENTY of TURTLE with nexty)
          (DrawTurtle])

(JUMP
  [LAMBDA (DISTANCE LINEWIDTH)                               (* dmr: "21-JUL-83 16:54")
    (PROG (nextx nexty)                                      (* This is the same code as FORWARD sans the DRAWLINE)
          (EraseTurtle)
          [SETQ nextx (FPLUS (fetch CURRENTX of TURTLE)
			     (FTIMES DISTANCE (COS (fetch HEADING of TURTLE]
          [SETQ nexty (FPLUS (fetch CURRENTY of TURTLE)
			     (FTIMES DISTANCE (SIN (fetch HEADING of TURTLE]
          (replace CURRENTX of TURTLE with nextx)
          (replace CURRENTY of TURTLE with nexty)
          (DrawTurtle])

(POINT
  [LAMBDA (THETA)                                            (* dmr: "21-JUL-83 11:28")
    (EraseTurtle)
    (replace HEADING of TURTLE with THETA)
    (DrawTurtle])

(PRETTY0
  [LAMBDA NIL                                                (* dmr: "30-JUN-83 13:19")
    (for i from 1 to 10
       do (FORWARD 50)
	  (TURN 178])

(PRETTY1
  [LAMBDA NIL                                                (* edited: "15-SEP-83 13:56")
    (CENTER)
    (POINT 90)
    (for i from 1 to 10
       do (DrawT)
	  (DrawT)
	  (TURN 10])

(PRETTY2
  [LAMBDA NIL                                                (* mh: "16-May-84 14:59")
    (CLEARWINDOW)
    (CENTER)
    (POINT 90)
    (for i from 1 to 20
       do (PRETTY0)
	  (TURN 10)
	  (DrawT])

(PRETTY3
  [LAMBDA NIL                                                (* mh: "16-May-84 14:55")
    (CENTER)
    (POINT 0)
    (LAMBDA NIL                                              (* dmr: "30-JUN-83 13:42")
      (CENTER)
      (POINT 0)
      (for i from 1 to 20
	 do (PRETTY0)
	    (JUMP 30])

(SetUpTurtleArray
  [LAMBDA NIL                                                (* dmr: "21-JUL-83 11:26")
    (SETQ TurtleArray (ARRAY 8 (QUOTE POINTER)))
    (SETA TurtleArray 3 t1)
    (SETA TurtleArray 2 t2)
    (SETA TurtleArray 1 t3)
    (SETA TurtleArray 8 t4)
    (SETA TurtleArray 7 t5)
    (SETA TurtleArray 6 t6)
    (SETA TurtleArray 5 t7)
    (SETA TurtleArray 4 t8])

(TREE
  [LAMBDA NIL                                                (* dmr: " 7-JUL-83 14:36")
    (FORWARD 50)
    (TURN 90 (QUOTE RIGHT))
    (FORWARD 50)
    (TURN 90 (QUOTE LEFT))
    (FORWARD 50)
    (TURN 90 (QUOTE LEFT))
    (FORWARD 125)
    (TURN 90 (QUOTE LEFT))
    (FORWARD 50)
    (TURN 90 (QUOTE LEFT))
    (FORWARD 50)
    (TURN 90 (QUOTE RIGHT))
    (FORWARD 50])

(TRITRI
  [LAMBDA (SIDE)                                             (* mh: "16-May-84 15:37")
    (CLEARWINDOW)
    (CENTER)
    (FORWARD 100)
    (TURN 120 (QUOTE LEFT))
    (FORWARD 25)
    (TURN 120 (QUOTE LEFT))
    (FORWARD 100)
    (TURN 120 (QUOTE LEFT))
    (FORWARD 25)
    (TURN 120 (QUOTE LEFT))
    (FORWARD 100)
    (TURN 120 (QUOTE LEFT))
    (FORWARD 25])

(TURN
  [LAMBDA (THETA DIRECTION)                                  (* dmr: "21-JUL-83 16:37")
                                                             (* THETA is number of degrees to turn.
							     Direction is either (QUOTE LEFT) or 
							     (QUOTE RIGHT.))
                                                             (* DrawArrow (fetch CURRENTX of TURTLE) 
							     (fetch CURRENTY of TURTLE) (fetch HEADING of TURTLE))
    (EraseTurtle)
    [replace HEADING of TURTLE with (COND
				      ((OR (EQUAL DIRECTION NIL)
					   (EQUAL DIRECTION (QUOTE LEFT)))
					(FPLUS (fetch HEADING of TURTLE)
					       THETA))
				      (T (FDIFFERENCE (fetch HEADING of TURTLE)
						      THETA]
    [COND
      ((LESSP (fetch HEADING of TURTLE)
	      0)
	(replace HEADING of TURTLE with (IPLUS (fetch HEADING of TURTLE)
					       360]
    [COND
      ((GREATERP (fetch HEADING of TURTLE)
		 360)
	(replace HEADING of TURTLE with (REMAINDER (fetch HEADING of TURTLE)
						   360]
    (DrawTurtle)                                             (* DrawArrow (fetch CURRENTX of TURTLE) 
							     (fetch CURRENTY of TURTLE) (fetch HEADING of TURTLE))
    ])
)
(DEFINEQ

(CCurve
  [LAMBDA (len angle minlen ds)                              (* dmr: "27-JUL-83 16:34")
    minLen←minlen
    (CCurve1 len angle ds])

(CCurve1
  [LAMBDA (len angle ds)                                     (* dmr: "27-JUL-83 16:35")
    (if (LESSP len minLen)
	then (POINT angle)
	     (FORWARD len)
      else (CCurve1 (FQUOTIENT len (SQRT 2.0))
		    (FPLUS angle 45)
		    ds)
	   (CCurve1 (FQUOTIENT len (SQRT 2.0))
		    (FDIFFERENCE angle 45)
		    ds])
)
[DECLARE: EVAL@COMPILE 

(RECORD LINE ((X1 Y1 Z1)
	      (X2 Y2 Z2)))

(RECORD TURTLE (HEADING CURRENTX CURRENTY WINDOW ERASED?))
]

(RPAQ t1 (READBITMAP))
(25 25
"@@AL@@@@"
"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BITMAP))
(25 25
"GHAOH@@@"
"HLACH@@@"
"HDON@@@@"
"LGJG@@@@"
"DL@AL@@@"
"CH@@F@@@"
"AAOHCAH@"
"CAL@AAH@"
"BAF@@KH@"
"FAC@@NH@"
"GAAH@DH@"
"I@@L@DH@"
"IH@F@FH@"
"IL@C@EH@"
"FD@AHH@@"
"FF@@@H@@"
"BC@@@H@@"
"@AL@A@@@"
"@@G@CN@@"
"@@MOOK@@"
"@AA@@A@@"
"@AA@@@H@"
"@AHH@@H@"
"@@HH@A@@"
"@@GH@@@@")

(RPAQQ TURTLE (240.0 340.0555 335.5 {WINDOW}#12,127062 NIL))

(RPAQ TurtleArray (READARRAY 8 (QUOTE POINTER) 1))
({BITMAP}#11,53030
{BITMAP}#12,163710
{BITMAP}#11,53022
{BITMAP}#12,163770
{BITMAP}#11,53556
{BITMAP}#11,53140
{BITMAP}#11,53066
{BITMAP}#12,163732
NIL
)

(RPAQQ TurtleArrow (((0 0 0)
		     (10 0 0))
		    ((7 4 0)
		     (10 0 0))
		    ((7 -4 0)
		     (10 0 0))))
(SETQ WINDOW1 (CREATEW (create REGION LEFT ← 300 BOTTOM ← 25 WIDTH ← 700 HEIGHT ← 700)
		       
    "                                ------ Turtle Graphics Window ------           July 1,1983 "
		       10))
(* This sets up the bit maps for each of the 8 turtles)
(SetUpTurtleArray)
(SETQ TURTLE (create TURTLE HEADING ← 0 CURRENTX ← 0 CURRENTY ← 0 WINDOW ← WINDOW1 ERASED? ← T))
(CENTER)
(CLOSEW WINDOW1)
(DECLARE: DONTCOPY
  (FILEMAP (NIL (1292 9577 (CENTER 1302 . 1880) (CLEARWINDOW 1882 . 2214) (ComputeTurtleArrayIndex 2216
 . 2635) (DRAW 2637 . 2920) (DrawT 2922 . 3361) (DrawTurtle 3363 . 3793) (EraseTurtle 3795 . 4319) (
FORWARD 4321 . 5110) (JUMP 5112 . 5769) (POINT 5771 . 5972) (PRETTY0 5974 . 6164) (PRETTY1 6166 . 6404
) (PRETTY2 6406 . 6664) (PRETTY3 6666 . 7016) (SetUpTurtleArray 7018 . 7405) (TREE 7407 . 7845) (
TRITRI 7847 . 8278) (TURN 8280 . 9575)) (9578 10104 (CCurve 9588 . 9741) (CCurve1 9743 . 10102)))))
STOP