created a version of Minesweeper while I was bored at school. Just wanted to put it up here.
Should this go under the Forum "Your projects"? I didn't know if it should, so I put it right here instead. Would rather not want to be known as a rule-breaker. ;)
DelVar [A]{8,16→dim([A] //clearing and setting matrices
DelVar [B]{8,16→dim([B]
128→F /setting variables
ClrHome
Fill(1,[A]:Fill(1,[B]
DelVar ADelVar E
randInt(1,8→C
randInt(1,16→D
While A<1 or A>128 //user input loop for mines
ClrHome
Disp " Minesweeper
Output(3,10,"(1-100)
Input "Amount of mines?",A
End
A→G
F-A→F
ClrHome
For(B,1,A //start of placing in mines
Output(1,1,B //animation for screen (not needed)
Output(1,4,"/
Output(1,5,A //end of animation
While not([A](C,D //random placing mine loop (make sure mines are not on top of each other)
randInt(1,8→C
randInt(1,16→D
End
0→[A](C,D //placing mine and numbers around it (takes a little)
If C+1≠9 and D+1≠17:Then
If [A](C+1,D+1:1+[A](C+1,D+1→[A](C+1,D+1
End
If C-1 and D+1≠17:Then
If [A](C-1,D+1:1+[A](C-1,D+1→[A](C-1,D+1
End
If C+1≠9 and D-1:Then
If [A](C+1,D-1:1+[A](C+1,D-1→[A](C+1,D-1
End
If C-1 and D-1:Then
If [A](C-1,D-1:1+[A](C-1,D-1→[A](C-1,D-1
End
If D+1≠17:Then
If [A](C,D+1:1+[A](C,D+1→[A](C,D+1
End
If D-1:Then
If [A](C,D-1:1+[A](C,D-1→[A](C,D-1
End
If C+1≠9:Then
If [A](C+1,D:1+[A](C+1,D→[A](C+1,D
End
If C-1:Then
If [A](C-1,D):1+[A](C-1,D→[A](C-1,D
End
End //end of mine loop
ClrHome
For(C,1,8 //filling in screen
For(D,1,16
Output(C,D,"▫
End
End
1→A:1→B:1→C
Output(A,B,"+
While C=1 //start of playing loop
getKey→D
If D=21:Then //revealing spot
If not([A](A,B):DelVar C //losing statement
If [B](A,B)=1 and [A](A,B):F-1→F
0→[B](A,B
End
If (D=26 and B≠16) or (D=24 and B≠1) or (D=25 and A≠1) or (D=34 and A≠8:Then //movement
If not([B](A,B)
Output(A,B,sub(" 12345678",[A](A,B)+1,1
If [B](A,B)>0
Output(A,B,sub(" ▫/",[B](A,B)+1,1
B+(D=26)-(D=24→B
A+(D=34)-(D=25→A
Output(A,B,"+
End //end of movement statement
If D=31 and [B](A,B)=1:Then //marking mines
2→[B](A,B
0→D
End
If D=31 and [B](A,B)=2:1→[B](A,B //un-marking mines
If not(F:DelVar C //win statement
End
If F:Then //losing statment (continued)
Output(A,B,"*
For(C,1,500
End
For(C,1,8
For(D,1,16
If not([A](C,D)
Output(C,D,"*
End
End
End //end of losing statement
If not(F:Then //win statment (continued)
For(A,1,8
For(B,1,16
Output(A,B,sub("⁺ 12345678",[A](A,B)+1,1
End
End
End //end of win statement
Pause
ClrHome
If not(F:Disp "You win!
If F:Disp "You lost
Output(2,1,(128-G)-F //displaying total squares uncovered
Output(2,5,"OF
Output(2,8,128-G
DelVar [A]DelVar [B] //clearing out big files (a.k.a matrices)