Home » Archimedes archive » Archimedes World » AW-1995-04-Disc1.adf » Disk1Apr95 » !AWApr95/Goodies/Draw/!DrawBasic/Library/Logo/Example_5

!AWApr95/Goodies/Draw/!DrawBasic/Library/Logo/Example_5

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Archimedes World » AW-1995-04-Disc1.adf » Disk1Apr95
Filename: !AWApr95/Goodies/Draw/!DrawBasic/Library/Logo/Example_5
Read OK:
File size: 01F4 bytes
Load address: 0000
Exec address: 0000
File contents
REM Recursive polygon curve
REM
REM References
REM
REM   1) "Turtle Geometry" : H.Abelson & A. diSessa pub. MIT  p.93
REM
acc=1/32 : angle=144
 �Inches
 �PathBegin(path)
 �Turtle(2,3,0)
 �CornerPoly(1,angle,0)
 �PathEnd
�Quit

DEF �CornerPoly(size,angle,total_turn)
LOCAL i
 IF size>acc THEN
  REPEAT
  �CornerPolyStep(size,angle)
   total_turn+=angle
   UNTIL total_turn MOD 360 = 0
 ENDIF
ENDPROC

DEF �CornerPolyStep(size,angle)
 �Forward(size)
 �CornerPoly(size/2,-angle,0)
 �Right(angle)
ENDPROC
00000000  52 45 4d 20 52 65 63 75  72 73 69 76 65 20 70 6f  |REM Recursive po|
00000010  6c 79 67 6f 6e 20 63 75  72 76 65 0a 52 45 4d 0a  |lygon curve.REM.|
00000020  52 45 4d 20 52 65 66 65  72 65 6e 63 65 73 0a 52  |REM References.R|
00000030  45 4d 0a 52 45 4d 20 20  20 31 29 20 22 54 75 72  |EM.REM   1) "Tur|
00000040  74 6c 65 20 47 65 6f 6d  65 74 72 79 22 20 3a 20  |tle Geometry" : |
00000050  48 2e 41 62 65 6c 73 6f  6e 20 26 20 41 2e 20 64  |H.Abelson & A. d|
00000060  69 53 65 73 73 61 20 70  75 62 2e 20 4d 49 54 20  |iSessa pub. MIT |
00000070  20 70 2e 39 33 0a 52 45  4d 0a 61 63 63 3d 31 2f  | p.93.REM.acc=1/|
00000080  33 32 20 3a 20 61 6e 67  6c 65 3d 31 34 34 0a 20  |32 : angle=144. |
00000090  a0 49 6e 63 68 65 73 0a  20 a0 50 61 74 68 42 65  |.Inches. .PathBe|
000000a0  67 69 6e 28 70 61 74 68  29 0a 20 a0 54 75 72 74  |gin(path). .Turt|
000000b0  6c 65 28 32 2c 33 2c 30  29 0a 20 a0 43 6f 72 6e  |le(2,3,0). .Corn|
000000c0  65 72 50 6f 6c 79 28 31  2c 61 6e 67 6c 65 2c 30  |erPoly(1,angle,0|
000000d0  29 0a 20 a0 50 61 74 68  45 6e 64 0a a0 51 75 69  |). .PathEnd..Qui|
000000e0  74 0a 0a 44 45 46 20 a0  43 6f 72 6e 65 72 50 6f  |t..DEF .CornerPo|
000000f0  6c 79 28 73 69 7a 65 2c  61 6e 67 6c 65 2c 74 6f  |ly(size,angle,to|
00000100  74 61 6c 5f 74 75 72 6e  29 0a 4c 4f 43 41 4c 20  |tal_turn).LOCAL |
00000110  69 0a 20 49 46 20 73 69  7a 65 3e 61 63 63 20 54  |i. IF size>acc T|
00000120  48 45 4e 0a 20 20 52 45  50 45 41 54 0a 20 20 a0  |HEN.  REPEAT.  .|
00000130  43 6f 72 6e 65 72 50 6f  6c 79 53 74 65 70 28 73  |CornerPolyStep(s|
00000140  69 7a 65 2c 61 6e 67 6c  65 29 0a 20 20 20 74 6f  |ize,angle).   to|
00000150  74 61 6c 5f 74 75 72 6e  2b 3d 61 6e 67 6c 65 0a  |tal_turn+=angle.|
00000160  20 20 20 55 4e 54 49 4c  20 74 6f 74 61 6c 5f 74  |   UNTIL total_t|
00000170  75 72 6e 20 4d 4f 44 20  33 36 30 20 3d 20 30 0a  |urn MOD 360 = 0.|
00000180  20 45 4e 44 49 46 0a 45  4e 44 50 52 4f 43 0a 0a  | ENDIF.ENDPROC..|
00000190  44 45 46 20 a0 43 6f 72  6e 65 72 50 6f 6c 79 53  |DEF .CornerPolyS|
000001a0  74 65 70 28 73 69 7a 65  2c 61 6e 67 6c 65 29 0a  |tep(size,angle).|
000001b0  20 a0 46 6f 72 77 61 72  64 28 73 69 7a 65 29 0a  | .Forward(size).|
000001c0  20 a0 43 6f 72 6e 65 72  50 6f 6c 79 28 73 69 7a  | .CornerPoly(siz|
000001d0  65 2f 32 2c 2d 61 6e 67  6c 65 2c 30 29 0a 20 a0  |e/2,-angle,0). .|
000001e0  52 69 67 68 74 28 61 6e  67 6c 65 29 0a 45 4e 44  |Right(angle).END|
000001f0  50 52 4f 43                                       |PROC|
000001f4