Home » Recent acquisitions » Acorn ADFS disks » adfs_AcornUser_199801_2.adf » Regulars2 » StarInfo/Fletcher/Tanner/Vibe/TXTMAZE

StarInfo/Fletcher/Tanner/Vibe/TXTMAZE

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 » Recent acquisitions » Acorn ADFS disks » adfs_AcornUser_199801_2.adf » Regulars2
Filename: StarInfo/Fletcher/Tanner/Vibe/TXTMAZE
Read OK:
File size: 03F9 bytes
Load address: 0000
Exec address: 0000
File contents
   10REM > TXTMAZE
   20
   30MODE31:OFF
   40PRINT"TEXT maze"'
   50PRINT"This program generates a maze in text format"
   60PRINT"using only the characters -,!,+ and space."'
   70INPUT"Width in characters="ZX%,"Height in characters="ZY%:CLS
   80IF ZX%<9 ZX%=9
   90IF ZY%<9 ZY%=9
  100ZX%=((ZX%-1)DIV4)*4+1:ZY%=((ZY%-1)DIV4)*4+1
  110DIM A%(ZX%+1,ZY%+1)
  120CX%=(ZX%+1)/2:CY%=(ZY%+1)/2
  130FORN%=CX%-4TOCX%+4:A%(N%,CY%-4)=1:A%(N%,CY%+4)=1:NEXT
  140FORN%=CY%-4TOCY%+4:A%(CX%-4,N%)=1:A%(CX%+4,N%)=1:NEXT
  150A%(CX%-4,CY%+3)=0
  160PROCA(CX%-4,CY%+4)
  170
  180FORY%=1TOZY%:FORX%=1TOZX%
  190IF A%(X%,Y%)=0 THEN
  200PRINT" ";
  210ELSE
  220K%=0
  230IF A%(X%,Y%+1)=1 K%+=1
  240IF A%(X%+1,Y%)=1 K%+=2
  250IF A%(X%,Y%-1)=1 K%+=4
  260IF A%(X%-1,Y%)=1 K%+=8
  270CASE K% OF
  280WHEN 2,8,10:PRINT"-";
  290WHEN 1,4,5:PRINT"!";
  300OTHERWISE:PRINT"+";
  310ENDCASE
  320ENDIF
  330NEXT:PRINT:NEXT
  340END
  350
  360DEFPROCA(X%,Y%)
  370LOCAL N%,DX%,DY%
  380A%(X%,Y%)=1
  390FORN%=1TO12
  400DX%=0:DY%=0
  410IFRND(1)>.5 THEN
  420REPEAT:DX%=SGN(RND(1)-.5):UNTIL X%+2*DX%<=ZX% AND X%+2*DX%>=1
  430ELSE
  440REPEAT:DY%=SGN(RND(1)-.5):UNTIL Y%+2*DY%<=ZY% AND Y%+2*DY%>=1
  450ENDIF
  460IF A%(X%+2*DX%,Y%+2*DY%)=0THEN
  470A%(X%+DX%,Y%+DY%)=1:PROCA(X%+2*DX%,Y%+2*DY%)
  480ENDIF
  490NEXT
  500ENDPROC

� > TXTMAZE

	�31:�
(�"TEXT maze"'
23�"This program generates a maze in text format"
<2�"using only the characters -,!,+ and space."'
F;�"Width in characters="ZX%,"Height in characters="ZY%:�
P� ZX%<9 ZX%=9
Z� ZY%<9 ZY%=9
d+ZX%=((ZX%-1)�4)*4+1:ZY%=((ZY%-1)�4)*4+1
n� A%(ZX%+1,ZY%+1)
xCX%=(ZX%+1)/2:CY%=(ZY%+1)/2
�3�N%=CX%-4�CX%+4:A%(N%,CY%-4)=1:A%(N%,CY%+4)=1:�
�3�N%=CY%-4�CY%+4:A%(CX%-4,N%)=1:A%(CX%+4,N%)=1:�
�A%(CX%-4,CY%+3)=0
��A(CX%-4,CY%+4)
�
��Y%=1�ZY%:�X%=1�ZX%
�� A%(X%,Y%)=0 �
�	�" ";
��
�K%=0
�� A%(X%,Y%+1)=1 K%+=1
�� A%(X%+1,Y%)=1 K%+=2
�� A%(X%,Y%-1)=1 K%+=4
� A%(X%-1,Y%)=1 K%+=8
Ȏ K% �
� 2,8,10:�"-";
"� 1,4,5:�"!";
,:�"+";
6�
@�
J	�:�:�
T�
^
h��A(X%,Y%)
r� N%,DX%,DY%
|A%(X%,Y%)=1
��N%=1�12
�DX%=0:DY%=0
��(1)>.5 �
�2�:DX%=�(�(1)-.5):� X%+2*DX%<=ZX% � X%+2*DX%>=1
��
�2�:DY%=�(�(1)-.5):� Y%+2*DY%<=ZY% � Y%+2*DY%>=1
��
�� A%(X%+2*DX%,Y%+2*DY%)=0�
�-A%(X%+DX%,Y%+DY%)=1:�A(X%+2*DX%,Y%+2*DY%)
��
��
��
�
00000000  0d 00 0a 0f f4 20 3e 20  54 58 54 4d 41 5a 45 0d  |..... > TXTMAZE.|
00000010  00 14 04 0d 00 1e 09 eb  33 31 3a 87 0d 00 28 11  |........31:...(.|
00000020  f1 22 54 45 58 54 20 6d  61 7a 65 22 27 0d 00 32  |."TEXT maze"'..2|
00000030  33 f1 22 54 68 69 73 20  70 72 6f 67 72 61 6d 20  |3."This program |
00000040  67 65 6e 65 72 61 74 65  73 20 61 20 6d 61 7a 65  |generates a maze|
00000050  20 69 6e 20 74 65 78 74  20 66 6f 72 6d 61 74 22  | in text format"|
00000060  0d 00 3c 32 f1 22 75 73  69 6e 67 20 6f 6e 6c 79  |..<2."using only|
00000070  20 74 68 65 20 63 68 61  72 61 63 74 65 72 73 20  | the characters |
00000080  2d 2c 21 2c 2b 20 61 6e  64 20 73 70 61 63 65 2e  |-,!,+ and space.|
00000090  22 27 0d 00 46 3b e8 22  57 69 64 74 68 20 69 6e  |"'..F;."Width in|
000000a0  20 63 68 61 72 61 63 74  65 72 73 3d 22 5a 58 25  | characters="ZX%|
000000b0  2c 22 48 65 69 67 68 74  20 69 6e 20 63 68 61 72  |,"Height in char|
000000c0  61 63 74 65 72 73 3d 22  5a 59 25 3a db 0d 00 50  |acters="ZY%:...P|
000000d0  11 e7 20 5a 58 25 3c 39  20 5a 58 25 3d 39 0d 00  |.. ZX%<9 ZX%=9..|
000000e0  5a 11 e7 20 5a 59 25 3c  39 20 5a 59 25 3d 39 0d  |Z.. ZY%<9 ZY%=9.|
000000f0  00 64 2b 5a 58 25 3d 28  28 5a 58 25 2d 31 29 81  |.d+ZX%=((ZX%-1).|
00000100  34 29 2a 34 2b 31 3a 5a  59 25 3d 28 28 5a 59 25  |4)*4+1:ZY%=((ZY%|
00000110  2d 31 29 81 34 29 2a 34  2b 31 0d 00 6e 15 de 20  |-1).4)*4+1..n.. |
00000120  41 25 28 5a 58 25 2b 31  2c 5a 59 25 2b 31 29 0d  |A%(ZX%+1,ZY%+1).|
00000130  00 78 1f 43 58 25 3d 28  5a 58 25 2b 31 29 2f 32  |.x.CX%=(ZX%+1)/2|
00000140  3a 43 59 25 3d 28 5a 59  25 2b 31 29 2f 32 0d 00  |:CY%=(ZY%+1)/2..|
00000150  82 33 e3 4e 25 3d 43 58  25 2d 34 b8 43 58 25 2b  |.3.N%=CX%-4.CX%+|
00000160  34 3a 41 25 28 4e 25 2c  43 59 25 2d 34 29 3d 31  |4:A%(N%,CY%-4)=1|
00000170  3a 41 25 28 4e 25 2c 43  59 25 2b 34 29 3d 31 3a  |:A%(N%,CY%+4)=1:|
00000180  ed 0d 00 8c 33 e3 4e 25  3d 43 59 25 2d 34 b8 43  |....3.N%=CY%-4.C|
00000190  59 25 2b 34 3a 41 25 28  43 58 25 2d 34 2c 4e 25  |Y%+4:A%(CX%-4,N%|
000001a0  29 3d 31 3a 41 25 28 43  58 25 2b 34 2c 4e 25 29  |)=1:A%(CX%+4,N%)|
000001b0  3d 31 3a ed 0d 00 96 15  41 25 28 43 58 25 2d 34  |=1:.....A%(CX%-4|
000001c0  2c 43 59 25 2b 33 29 3d  30 0d 00 a0 13 f2 41 28  |,CY%+3)=0.....A(|
000001d0  43 58 25 2d 34 2c 43 59  25 2b 34 29 0d 00 aa 04  |CX%-4,CY%+4)....|
000001e0  0d 00 b4 17 e3 59 25 3d  31 b8 5a 59 25 3a e3 58  |.....Y%=1.ZY%:.X|
000001f0  25 3d 31 b8 5a 58 25 0d  00 be 13 e7 20 41 25 28  |%=1.ZX%..... A%(|
00000200  58 25 2c 59 25 29 3d 30  20 8c 0d 00 c8 09 f1 22  |X%,Y%)=0 ......"|
00000210  20 22 3b 0d 00 d2 05 cc  0d 00 dc 08 4b 25 3d 30  | ";.........K%=0|
00000220  0d 00 e6 19 e7 20 41 25  28 58 25 2c 59 25 2b 31  |..... A%(X%,Y%+1|
00000230  29 3d 31 20 4b 25 2b 3d  31 0d 00 f0 19 e7 20 41  |)=1 K%+=1..... A|
00000240  25 28 58 25 2b 31 2c 59  25 29 3d 31 20 4b 25 2b  |%(X%+1,Y%)=1 K%+|
00000250  3d 32 0d 00 fa 19 e7 20  41 25 28 58 25 2c 59 25  |=2..... A%(X%,Y%|
00000260  2d 31 29 3d 31 20 4b 25  2b 3d 34 0d 01 04 19 e7  |-1)=1 K%+=4.....|
00000270  20 41 25 28 58 25 2d 31  2c 59 25 29 3d 31 20 4b  | A%(X%-1,Y%)=1 K|
00000280  25 2b 3d 38 0d 01 0e 0b  c8 8e 20 4b 25 20 ca 0d  |%+=8...... K% ..|
00000290  01 18 12 c9 20 32 2c 38  2c 31 30 3a f1 22 2d 22  |.... 2,8,10:."-"|
000002a0  3b 0d 01 22 11 c9 20 31  2c 34 2c 35 3a f1 22 21  |;..".. 1,4,5:."!|
000002b0  22 3b 0d 01 2c 0b 7f 3a  f1 22 2b 22 3b 0d 01 36  |";..,..:."+";..6|
000002c0  05 cb 0d 01 40 05 cd 0d  01 4a 09 ed 3a f1 3a ed  |....@....J..:.:.|
000002d0  0d 01 54 05 e0 0d 01 5e  04 0d 01 68 0e dd f2 41  |..T....^...h...A|
000002e0  28 58 25 2c 59 25 29 0d  01 72 10 ea 20 4e 25 2c  |(X%,Y%)..r.. N%,|
000002f0  44 58 25 2c 44 59 25 0d  01 7c 0f 41 25 28 58 25  |DX%,DY%..|.A%(X%|
00000300  2c 59 25 29 3d 31 0d 01  86 0c e3 4e 25 3d 31 b8  |,Y%)=1.....N%=1.|
00000310  31 32 0d 01 90 0f 44 58  25 3d 30 3a 44 59 25 3d  |12....DX%=0:DY%=|
00000320  30 0d 01 9a 0e e7 b3 28  31 29 3e 2e 35 20 8c 0d  |0......(1)>.5 ..|
00000330  01 a4 32 f5 3a 44 58 25  3d b4 28 b3 28 31 29 2d  |..2.:DX%=.(.(1)-|
00000340  2e 35 29 3a fd 20 58 25  2b 32 2a 44 58 25 3c 3d  |.5):. X%+2*DX%<=|
00000350  5a 58 25 20 80 20 58 25  2b 32 2a 44 58 25 3e 3d  |ZX% . X%+2*DX%>=|
00000360  31 0d 01 ae 05 cc 0d 01  b8 32 f5 3a 44 59 25 3d  |1........2.:DY%=|
00000370  b4 28 b3 28 31 29 2d 2e  35 29 3a fd 20 59 25 2b  |.(.(1)-.5):. Y%+|
00000380  32 2a 44 59 25 3c 3d 5a  59 25 20 80 20 59 25 2b  |2*DY%<=ZY% . Y%+|
00000390  32 2a 44 59 25 3e 3d 31  0d 01 c2 05 cd 0d 01 cc  |2*DY%>=1........|
000003a0  1e e7 20 41 25 28 58 25  2b 32 2a 44 58 25 2c 59  |.. A%(X%+2*DX%,Y|
000003b0  25 2b 32 2a 44 59 25 29  3d 30 8c 0d 01 d6 2d 41  |%+2*DY%)=0....-A|
000003c0  25 28 58 25 2b 44 58 25  2c 59 25 2b 44 59 25 29  |%(X%+DX%,Y%+DY%)|
000003d0  3d 31 3a f2 41 28 58 25  2b 32 2a 44 58 25 2c 59  |=1:.A(X%+2*DX%,Y|
000003e0  25 2b 32 2a 44 59 25 29  0d 01 e0 05 cd 0d 01 ea  |%+2*DY%)........|
000003f0  05 ed 0d 01 f4 05 e1 0d  ff                       |.........|
000003f9