MINE (C64) by Kevin Prosser
A downloadable game
MINE
Minefield is a one player game for the Commodore 64.
There will be a slight delay while the mines are randomly placed on the minefield.
Once this is done, the minefield grid will be drawn.
Each unexplored space is represented by a circle. The cursor position will blink. Use the cursor keys to move the cursor around the minefield. Press the space bar to examine a spot. If the spot contains a mine, the game will be over. If there is no mine, the circle will be replaced with a number indicating how many adjacent spots have a mine in it. A number in the upper left will indicate how many spaces remain that do not contain a mine.
When the count decrements to zero, you will have examined all the open spaces without hitting a mine and you win. If you think a spot has a mine, you can flag that spot without examining it by typing the F key. A plus sign will replace the circle when a flag is present.
1 K=20:L=K-2:PRINT"SQSTBY...":DIMM(K,K):DIMN(K,K):C=L*L:G=1105:FORX=1TOK:FORY=1TOK
K is the size of the minefield, L is the playable portion. M array holds mine info, N array holds the number of adjacent mines to each spot. C is the number of non-mine locations. G is upper left of grid on the screen
2 W=(X<>1)*(X<>K)*(Y<>1)*(Y<>K)*INT(RND(0)*1.1):N(X,Y)=0:C=C-W:M(X,Y)=W:NEXT
W randomly places a mine inside the playable area. And decrements C, N array is reset to all zeros. To increase the difficulty, change the 1.1 in the random function to a slightly higher value.
3 NEXT:FORX=2TO19:FORY=2TO19:H=0:FORI=-1TO1:FORJ=-1TO1:H=H+M(X+I,Y+J):NEXT:NEXT
Count up the number of mines adjacent to each spot
4 N(X,Y)=H:POKEG+x+40*Y,81:NEXT:NEXT:PRINT"S";C;"SQCRSR=MOVE, SPACE=OPEN, F=FLAG
place the grid on the screen, print the remaining open spaces, print instructions
5 S=40*Y+X+G:Z$="OQ|] FX+":X=2:Y=2
S is location on screen given x y coordinates. Z$ is a string of allowable inputs
6 I=0:GETA$:FORT=1TO8:I=I-T*(A$=MID$(Z$,T,1)):NEXT:F=PEEK(S):F=(F=209)OR(F=171)
Get the index number for the user input. f is flag for counting remaining open spaces. 209 is the symbol for unexamined spot, 171 is symbol for flag “+” (also unexamined), any other symbol is for a previously examined spot.
7 POKES,127ANDPEEK(S):J=M(X,Y):X=X-(I=3)*(X>2)+(I=4)*(X<=l):if(I>5)THENPOKES,43
127and will Un-Reverse video of the symbol at the old cursor location, j is set to 1 if a mine is preset at current cursor location. update X value of cursor. Poke 43 puts a flag on the current space but does not examine it.
8 Y=Y-(I=1)*(Y>2)+(I=2)*(Y<=l):S=X+40*Y+G:POKES,128ORPEEK(S):IFC<1THENPRINT"WIN!!!"
Move the Y value of the cursor and reverse video character at that location
9 H=N(X,Y):IF(I=5)AND(J=0)THENPOKES,48+H:C=C+F:PRINT"S";C;:GOTO6
If space bar (open) and there is no mine (j=0) then display on the screen the number of adjacent mines. Update count of open spaces remaining
10 PRINT"| ";:IF(I<>5)OR(M(X,Y)=0)THENGOTO6
If a mine is at present cursor and player opens it, end program otherwise goto6 for new input
Status | Released |
Author | BASIC 10Liner |
Genre | Strategy |
Tags | 8-Bit, basic, basic10liner, Commodore 64 |
Download
Install instructions
This program will run on the VICE Emulator for the C64. To play:
LOAD”MINE”,8
When Loaded, type RUN and return
Leave a comment
Log in with itch.io to leave a comment.