Fehérke's GitHub Site == glue between Fehérke's GitHub hosted projects

minesweeper.sh - the usual mine sweeper game

I always appreciated the simple games with original concept. The Mine Sweeper is one of them. Alas most of its implementations are in graphic mode and works only with mouse. Since now, I already wrote a few Mine Sweeper programs which correct the above two misses. But this one is special for me. Mostly, because is my first game written in shell script.

The code of this game is also on my favorites list, because excepting the unavoidable tput command, I used almost no external executables.

My thought on games is that they serve as relaxation tool for hard-working programmers. After several hours of coding is necessary to take a break. And play something. I mean play. No race, no excitement. This is why I usually do not implement high scores, sound effects and similar useless things.

Usage

minesweeper.sh usually has a nice color interface, but probably there are terminals on which fails to work :

sample output - minesweeper.sh

Mine Sweeper   version 1.0   december 2005   written by Feherke
board : S    size : 10*10   mine : 15   flag : 11   :)
 # # # # # # # # # # 
 #[#]# # # # # # # # 
 # # 2 3 2 3 F F 2 1 
 1 2 F 3 F 2 3 3 2 . 
 . 1 2 F 2 1 1 F 1 . 
 . 1 2 2 1 . 1 1 1 . 
 . 1 F 1 . . . . . . 
 1 2 2 1 . . . . . . 
 1 F 2 1 2 2 2 1 . . 
 1 1 2 F 2 F F 1 . . 
<h/j/k/l> Move <g> Step <f> Flag <n/N/m/M> New <q> Quit

For navigation there are available 3 sets of mappings :

layout left down up right step flag
Vi h j k l g f
Lefthand a s w d Space f
Numeric 4 2 8 6 Enter 0

Beside those, 3 additional commands exist :

key command
r redraw the board
q quit the script

Configuration

None.

However there are 4 predefined board setups and a new game starts by choosing one of them :

key board size mines
n Small 10*10 15
N Medium 15*15 33
m Large 20*20 60
M Extra 30*20 90

Versions

Plans

Download

You can find the related files on GitHub in my Bash-script repository’s minesweeper directory :