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

StarInfo/Fletcher/Tanner/Vibe/TXTMAZE2

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/TXTMAZE2
Read OK:
File size: 042C bytes
Load address: 0000
Exec address: 0000
File contents
   10REM > TXTMAZE2
   20
   30MODE31:OFF
   40PRINT"TEXT maze"'
   50PRINT"This program generates a maze in text format, suitable for"
   60PRINT"printing, using only the characters -,!,+ and space."'
   70INPUT"Width in cells="ZX%,"Height in cells="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 1,4,5:PRINT"! ";
  290WHEN 8:PRINT"- ";
  300WHEN 2,10:PRINT"--";
  310WHEN 9,12,13:PRINT"+ ";
  320OTHERWISE:PRINT"+-";
  330ENDCASE
  340ENDIF
  350NEXT:PRINT:NEXT
  360END
  370
  380DEFPROCA(X%,Y%)
  390LOCAL N%,DX%,DY%
  400A%(X%,Y%)=1
  410FORN%=1TO12
  420DX%=0:DY%=0
  430IFRND(1)>.5 THEN
  440REPEAT:DX%=SGN(RND(1)-.5):UNTIL X%+2*DX%<=ZX% AND X%+2*DX%>=1
  450ELSE
  460REPEAT:DY%=SGN(RND(1)-.5):UNTIL Y%+2*DY%<=ZY% AND Y%+2*DY%>=1
  470ENDIF
  480IF A%(X%+2*DX%,Y%+2*DY%)=0THEN
  490A%(X%+DX%,Y%+DY%)=1:PROCA(X%+2*DX%,Y%+2*DY%)
  500ENDIF
  510NEXT
  520ENDPROC

� > TXTMAZE2

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