Pseudoprogrammer wrote:
I'm assuming the maze has an entrance and an exit which are on the edges of the screen.
Indeed, I got that now. Mufin, what progress? For(A,1,61
For(B,1,93
If 2<(pxltest(A,B+1)+pxltest(A,B-1)+pxltest(A+1,B)+pxltest(A-1,B)
pxlon(A,B)
If 2<(pxltest(A,95-B)+pxltest(A,93-B)+pxltest(A+1,94-B)+pxltest(A-1,94-B)
pxlon(A,94-B)
End
End
prgmMAZE
[[7,10,10,10,14,10,10,14,8][5,2,14,10,9,6,12,3,12][7,12,5,6,12,5,3,10,9][5,5,3,9,5,3,10,12,4][5,7,10,10,11,14,10,9,5][5,5,6,14,10,11,14,10,9][5,5,5,1,6,12,3,10,12][3,9,7,12,5,3,10,8,5][2,10,9,3,11,10,10,10,13->[A]
dim([A]->L1
Ans->dim([B]
0->dim(L2
{1,1,9,9->L3
ClrDraw
AxesOff
GridOff
For(A,1,L1(1
For(B,1,L1(2
If max([A](A,B)={7,11,13,14
augment(L2,{A,B->L2
For(C,1,3
For(D,1,3
Pxl-On(3A-C,3B-D
End
End
If [A](A,B
Pxl-Off(3A-2,3B-2
For(C,3,0,~1
If int(2fPart(.5[A](A,B)/2^C
Pxl-Off(3A-2-not(C)+(C=2),3B-2-(C=3)+(C=1
End
End
End
Repeat W
1->W
For(A,1,dim(L2)-1,2
If 2<sum(int(2fPart(.5[A](L2(A),L2(A+1))/{1,2,4,8
Then
For(B,3,0,~1
L2(A->C
Ans-not(B)+(B=2->E
L2(A+1->D
Ans-(B=3)+(B=1->F
If int(2fPart(.5[A](C,D)/2^B
Then
prgmMAZE1
If max([A](E,F)={1,2,4,8
Then
0->W
2E-C->C
2F-D->D
prgmMAZE2
Else
If E=L2(A) and F=L2(A+1
Then
0->W
E->G
C->E
G->C
F->G
D->F
G->D
prgmMAZE2
Else
E->Z
F->Y
C->V
D->U
J->X
0->W
For(M,3,0,~1
Z->C
Ans-not(M)+(M=2->E
Y->D
Ans-(M=3)+(M=1->F
If int(2fPart(.5[A](C,D)/2^M
Then
prgmMAZE1
If E=Z and F=Y
Then
If J=X
X+2randInt(0,1)-1->X
If J>X
Then
0->W
2C-E->E
2D-F->F
prgmMAZE2
Else
0->W
V->C
2Ans-Z->E
U->D
2Ans-Y->F
prgmMAZE2
Pause
End
End
End
End
End
End
End
End
Else
If not(sum(A={1,dim(L2)-1
seq(L2(B+2(B>A)),B,1,dim(L2)-2->L2
End
End
End
------------------------------
prgmMAZE1
0->J
While not(max([A](E,F)={1,2,4,7,8,11,13,14,15
[A](E,F->H
E->G
2E-C-max(H={3,9})+max(H={6,12->E
G->C
F->G
2F-D-max(H={9,12})+max(H={3,6->F
G->D
End
----------------------------
prgmMAZE2
Repeat max([A](E,F)={1,2,4,7,8,11,13,14,15
[A](E,F->H
E->G
2E-C-max(H={3,9})+max(H={6,12->E
G->C
F->G
2F-D-max(H={9,12})+max(H={3,6->F
G->D
0->[A](C,D
For(K,1,3
For(L,1,3
Pxl-On(3C-K,3D-L
End
End
End
prgmMAZE3
-----------------------
prgmMAZE3
For(V,0,3
{E-not(V)+(V=2),F-(V=3)+(V=1
If Ans(1)(Ans(1)<=L1(1))Ans(2)(Ans(2)<=L1(2
Then
If int(2fPart(.5[A](E,F)/2^V)) and not(int(2fPart(.5[A](Ans(1),Ans(2))/2^(V+2(V<2)-2(V>1
Then
[A](E,F)-2^V->[A](E,F
Pxl-On(3E-2-not(V)+(V=2),3F-2-(V=3)+(V=1
End
End
End
0->Xmin
1->ΔX
-62->Ymin
1->ΔY
Input
For(A,1,-Y
For(B,1,X
If pxl-Test(A,B)(2<pxl-Test(A+1,B)+pxl-Test(A-1,B)+pxl-Test(A,B+1)+pxl-Test(A,B-1
Then
A->C
C->D
Repeat 2>=pxl-Test(A+1,B)+pxl-Test(A-1,B)+pxl-Test(A,B+1)+pxl-Test(A,B-1
pxl-On(C,D
C->E
C+pxl-Test(C+1,D)-pxl-Test(C-1,D->C
D+pxl-Test(E,D+1)-pxl-Test(E,D-1->D
End
End
End
End
Advertisement