Puzzle

File5
If A=sqrt pi
Then 10->Dim List 5
10->Dim List 6
0->A
Else sqrt pi->A
Dim List 5+Dim List 6->A
IfEnd
0->K
0->Q
0->M
Do
Q+1->Q
M<List 6[Q]=>List 6[Q]->M
LpWhile List 5[Q]>0
M>6=>6->M
File1
Do
ClrText
Green "Puzzle":" "
Orange "By B. Conijn":" "
"LEVEL 1-"
Locate 9,5,M+1
?->L
LpWhile L<1 Or L>M+1
File5
2->X:2->Y:0->P
L=1=>[[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1][1,0,1,3,3,0,0,0,0,0,1,0,2,0,0,0,0,0,6.1,3,1][1,2,1,3,3,1,0,0,1,2,0,0,1,1,1,1,1,1,1,7.1,1][1,0,1,1,1,1,0,1,1,0,1,0,1,0,0,0,3,3,3,3,1][1,0,0,0,1,0,0,1,0,0,1,1,1,0,1,1,1,1,1,3,1][1,0,1,0,0,0,0,1,0,0,0,0,0,0,4,5.1,3,1,5.1,3,1][1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]]->Mat A
L=2=>[[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1][1,6.6,1,3,0,0,1,3,0,3,1,0,0,0,1,3,7.1,3,3,3,1][1,2,1,0,1,2,1,1,7.2,2,7.3,0,1,2,1,1,6.5,3,2,3,1][1,0,0,0,1,3,1,0,2,3,6.2,1,1,0,1,1,1,1,1,0,1][1,0,1,0,1,0,7.4,0,1,0,1,1,0,0,1,0,0,0,7.7,0,1][1,7.5,5.1,0,7.6,6.4,1,0,0,6.3,1,6.1,6.7,0,0,0,0,0,1,5.1,1][1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]]->Mat A
L=3=>[[1,1,1,1,1,1,1,4,1,1,1,1,1,1,1,1,1,1,1,1,1][1,0,6.95,0,0,2,6.1,2,7.7,0,0,7.8,3,4,6.6,2,3,5.2,1,5.1,1][1,1,1,7.1,1,1,1,0,1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][1,1,2,1,7.15,1,7.8,5.7,1,5.6,5.5,0,7.6,2,1,1,6.4,2,3,1,1][1,6.1,6.15,0,0,1,3,1,3,1,1,1,1,6.6,1,6.2,2,5.1,2,6.3,1][1,3,1,0,1,1,1,0,0,2,0,0,7.7,2,1,7.3,6.9,2,6.5,7.2,1][1,5.1,7.1,0,2,3,0,0,6.8,1,3,1,0,5.2,1,5.2,7.9,3,1,5.3,1][1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]]->Mat A
L=7=>[[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1][1,0,0,0,2,0,0,0,0,0,1,7.1,6.4,0,0,2,3,6.5,1,3,1][1,0,1,0,1,0,6,0,1,6.1,2,2,1,1,0,1,0,0,7.4,7.5,1][1,2,1,2,1,3,2,3,1,2,2,0,7.2,0,2,0,0,1,1,5,1][1,7,0,3,1,1,2,1,4,0,2,6.3,0,1,0,1,0,1,3,1,1][1,4,1,6.2,1,4,0,0,2,0,0,1,0,0,0,7.3,3,1,5,3,1][1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]]->Mat A
ClrText
20->Dim List 1
20->Dim List 2
20->Dim List 3
20->Dim List 4
0->V
For 1->B To 7
For 1->A To 21
Mat A[B,A]->C
C=1=>Locate A,B,"#"
C=2=>Locate A,B,"U"
If C=3
Then Locate A,B,"S"
V+1->V
IfEnd
C=4=>Locate A,B,"*"
If Int C=5
Then Locate A,B,"~"
If List 1[Int (10C-49)]=0
Then 0->Z
Else 1->Z
IfEnd
B->List 1[Int (10C-49+10Z)]
A->List 2[Int (10C-49+10Z)]
IfEnd
Int C=6=>Locate A,B,"^"
If Int C=7
Then Locate A,B,"H"
B->List 3[20C-139]
A->List 4[20C-139]
IfEnd
Next
Next
Locate X,Y,"tau"
File1
Do
X->S
Y->T
Getkey->F
F=28=>X-1->S
F=37=>X+1->S
F=38=>Y-1->T
F=27=>Y+1->T
If X<>S Or Y<>T
Then File5
Mat A[S,T]->tau
If tau<>1 And tau<>4 And Int tau<>7
Then If tau=2
Then Mat A[2S-X,2T-Y]->E
If E=0
Then 0->Mat A[S,T]
2->Mat A[2S-X,2T-Y]
Locate 2T-Y,2S-X,"U"
Else If Int E=6
Then 0->Mat A[S,T]
2->Mat A[2S-X,2T-Y]
Locate 2T-Y,2S-X,"U"
0->Mat A[List 3[20E-119],List 4[20E-119]]
Locate List 4[20E-119],List 3[20E-119]," "
Else If E=4
Then 0->Mat A[S,T]
Else -1->tau
IfEnd
IfEnd
IfEnd
IfEnd
If tau<>-1
Then If tau=3
Then P+1->P
0->Mat A[S,T]
IfEnd
Mat A[S,T]->E
If Int E=5
Then Mat A[X,Y]=0=>Locate Y,X," "
Mat A[X,Y]=2=>Locate Y,X,"^"
Int Mat A[X,Y]=5=>Locate Y,X,"~"
S->X:T->Y
If List 1[10E-49]<>X Or List 2[10E-49]<>Y
Then List 1[10E-49]->S:List 2[10E-49]->T
Else List 1[10E-39]->S:List 2[10E-39]->T
IfEnd
IfEnd
Mat A[X,Y]=0=>Locate Y,X," "
Int Mat A[X,Y]=6=>Locate Y,X,"^"
Int Mat A[X,Y]=5=>Locate Y,X,"~"
S->X
T->Y
Locate Y,X,"tau"
K+1->K
IfEnd
IfEnd
File1
IfEnd
If P=V
Then ClrText
File5
Orange "STEPS:     BEST:"
Locate 7,1,K
Locate 17,1,List 5[L]
If K<List 5[L] Or List 6[L]=0
Then K->List 5[L]
L->List 6[L]
IfEnd
Locate 6,4,"~COMPLETED~"
File1
Stop
IfEnd
If F=77
Then ClrText
Locate 7,4,"~FAILURE~"
Stop
IfEnd
LpWhile 1