From 694ad73a9b697920eca876edbe41c39cfbec8334 Mon Sep 17 00:00:00 2001 From: Renaud Fivet Date: Wed, 24 Apr 2024 10:06:17 +0800 Subject: [PATCH] Clarify check of adjacent unmarked cells. --- factory/AMAZIN.BAS | 78 ++++++++++++++-------------------------------- 1 file changed, 24 insertions(+), 54 deletions(-) diff --git a/factory/AMAZIN.BAS b/factory/AMAZIN.BAS index b7bf1e8..5c1809c 100644 --- a/factory/AMAZIN.BAS +++ b/factory/AMAZIN.BAS @@ -26,8 +26,7 @@ 187 ' PICK EXIT CELL ON BOTTOM ROW AS CURRENT 190 R=FNR(H+1)-1\ S=V ' R,S CURRENT CELL COORD 192 V(R,S)=2 - 193 C=C-1 - 202 GOTO 260 + 193 GOTO 999 209 ' SCAN FOR NEXT POSITION TO CHECK 210 R=R+1 215 IF R<=H THEN 250 @@ -36,62 +35,33 @@ 230 S=0 250 IF V(R,S)=0 THEN 210 255 ' CHECK FOR ADJACENT UNMARKED CELLS AND PICK ONE AT RANDOM - 260 IF R=0 THEN 530\ IF V(R-1,S)<>0 THEN 530 ' L? - 270 IF S=0 THEN 390\ IF V(R,S-1)<>0 THEN 390 ' LU? - 290 IF R=H THEN 330\ IF V(R+1,S)<>0 THEN 330 ' LUR? - 310 ON FNR(3) GOTO 790,820,860 ' LUR - 320 ' LU - 330 IF S=V THEN 370\ IF V(R,S+1)<>0 THEN 370 ' LUD? - 350 ON FNR(3) GOTO 790,820,910 ' LUD - 370 ON FNR(2) GOTO 790,820 ' LU - 380 ' L - 390 IF R=H THEN 470\ IF V(R+1,S)<>0 THEN 470 ' LR? - 401 IF S=V THEN 450\ IF V(R,S+1)<>0 THEN 450 ' LRD? - 430 ON FNR(3) GOTO 790,860,910 ' LRD - 450 ON FNR(2) GOTO 790,860 ' LR - 460 ' L - 470 IF S=V THEN 790\ IF V(R,S+1)<>0 THEN 790 ' LD? OR L - 500 ON FNR(2) GOTO 790,910 ' LD - 520 ' - 530 IF S=0 THEN 670\ IF V(R,S-1)<>0 THEN 670 ' U? - 541 IF R=H THEN 610\ IF V(R+1,S)<>0 THEN 610 ' UR? - 550 IF S=V THEN 590\ IF V(R,S+1)<>0 THEN 590 ' URD? - 570 ON FNR(3) GOTO 820,860,910 ' URD - 590 ON FNR(2) GOTO 820,860 ' UR - 600 ' - 610 IF S=V THEN 820\ IF V(R,S+1)<>0 THEN 820 ' UD? OR U - 640 ON FNR(2) GOTO 820,910 ' UD - 660 ' - 670 IF R=H THEN 740\ IF V(R+1,S)<>0 THEN 740 ' R? - 681 IF S=V THEN 860\ IF V(R,S+1)<>0 THEN 860 ' RD? OR R - 710 ON FNR(2) GOTO 860,910 ' RD - 730 ' - 740 IF S=V THEN 210\ IF V(R,S+1)<>0 THEN 210 ' D? OR SCAN - 770 GOTO 910 ' D - 780 ' + 260 T=1 + 261 IF R=0 THEN 262\ IF V(R-1,S)<>0 THEN 262\ T=T+1 ' L + 262 IF S=0 THEN 263\ IF V(R,S-1)<>0 THEN 263\ T=T+2 ' U + 263 IF R=H THEN 264\ IF V(R+1,S)<>0 THEN 264\ T=T+4 ' R + 264 IF S=V THEN 265\ IF V(R,S+1)<>0 THEN 265\ T=T+8 ' D + 265 ' 0, L, U, LU, R, LR, UR,LUR, D, LD, UD,LUD, RD,LRD,URD,LURD + 300 ON T GOTO 210,790,820,370,860,450,590,310,910,500,640,350,710,430,570 + 310 ON FNR(3) GOTO 790,820,860 ' LUR + 350 ON FNR(3) GOTO 790,820,910 ' LUD + 370 ON FNR(2) GOTO 790,820 ' LU + 430 ON FNR(3) GOTO 790,860,910 ' LRD + 450 ON FNR(2) GOTO 790,860 ' LR + 500 ON FNR(2) GOTO 790,910 ' LD + 570 ON FNR(3) GOTO 820,860,910 ' URD + 590 ON FNR(2) GOTO 820,860 ' UR + 640 ON FNR(2) GOTO 820,910 ' UD + 710 ON FNR(2) GOTO 860,910 ' RD + 720 ' 790 ' REMOVE LEFT WALL - 800 R=R-1 - 801 V(R,S)=3 - 812 GOTO 999 + 800 R=R-1\ V(R,S)=3\ GOTO 999 820 ' REMOVE UP WALL - 830 S=S-1 - 840 V(R,S)=2 - 850 GOTO 999 + 830 S=S-1\ V(R,S)=2\ GOTO 999 860 ' REMOVE RIGHT WALL - 870 IF V(R,S)<2 THEN 880 - 872 V(R,S)=4 - 873 GOTO 890 - 880 V(R,S)=3 - 890 R=R+1 - 900 IF V(R,S)<>0 THEN 902\ V(R,S)=1 - 902 GOTO 999 + 870 V(R,S)=V(R,S)+2\ R=R+1\ GOTO 998 910 ' REMOVE DOWN WALL - 922 IF V(R,S)<2 THEN 940 - 930 V(R,S)=4 - 931 GOTO 950 - 940 V(R,S)=2 - 950 S=S+1 - 960 IF V(R,S)<>0 THEN 999\ V(R,S)=1 + 922 V(R,S)=V(R,S)+1\ S=S+1 + 998 V(R,S)=1 999 C=C-1\ IF C>0 THEN 260 ' LOOP WHILE C 1000 ' DRAW MAZE 1010 FOR J=0 TO V