Minesweeper!

``````DelVar [A]{8,16→dim([A]
[A]→[B]
DelVar A
Repeat A=10
randInt(2,7→Y
randInt(2,15→X
If [A](Y,X)≠9:Then
9→[A](Y,X
A+1→A
End
End
ClrHome
1→X:10→J
For(I,1,12
Output(4,3,sub("MINE*SWEEPER",1,I
X+(X≠5→X
Output(5,6,sub("V 1.1",1,X
End
Repeat K=105
getKey→K
min(8,max(7,Y+(K=34)-(K=25→Y
Output(7,7,"PLAY
Output(8,7,"EXIT
If Y=8:Output(Y-1,6," "
If Y=7:Output(Y+1,6," "
Output(Y,6,">
End
For(I,1,38
Output(randInt(1,8),randInt(1,16),"*
End
ClrHome
If Y=8:Return
4→Y:8→X
Output(1,1," -MINE*SWEEPER- "
Output(8,5,"FLAGS:
Output(8,11,J
For(A,2,7
Output(A,1,"I
Output(A,16,"I
For(B,2,15
Output(A,B,"x
End
End
Output(Y,X,"+
Repeat K=45 or K=1
getKey→K
If sum(K={24,25,26,34,45,105,23:Then
If sum(K={24,25,26,34:Then
Output(Y,X," "
Y→A:X→B
max(2,min(15,X+(K=26)-(K=24→X
max(2,min(7,Y+(K=34)-(K=25→Y
Output(Y,X,"+
If [B](A,B)=2:Output(A,B,"/
If [B](A,B)=0:Output(A,B,"x
If [B](A,B)=1:Then
DelVar E
For(I,A-1,A+1
For(H,B-1,B+1
If [A](I,H)=9:E+1→E
End
End
Output(A,B,E
End
End
If (K=23)(([B](Y,X)=2)+Jnot([B](Y,X):Then
J-1+2([B](Y,X)=2→J
abs([B](Y,X)-2→[B](Y,X
Output(8,11,"  "
Output(8,11,J
End
If (K=105)not([B](Y,X))not([A](Y,X:1→[B](Y,X
If (K=105)[A](Y,X)=9:1→K
End
End
0→F
For(A,2,7
For(B,2,15
If [A](A,B)=9 and [B](A,B)=2:F+1→F
End
End
ClrHome
If K=1:Disp "YOU HIT A MINE!
Disp "YOU CLEARED
If F=10:Disp "ALL
Disp F,"OF THE MINES``````