Minesweeper game


This is a simplistic minesweeper game. the original was written 
by Charles Forsyth and I simply modified it to use
P9r3's control(2) library.

Download the game here


How to play:
	there is no way currently to use mouse buttons 2 and 3 in control(2) 
	(or at least i have not found a way to do it) the mode of operation 
	as it is is to select the ones that you think do _not_ contain 
	mines. when mines are the only ones left uncovered on the field they 
	are 'revealed' to you. 
	
	to restart the game simply resize the window.
	
Drawbacks: 
	several off by one errors exist. don't pay attention to them :)

	panels, timers, statistics scores and other gui niceties do not exist

	the field is not dynamically allocated -- the maximum is 30x30

	you need to recompile if you want a harder level (see the #define at
	the top of the source code)
	
	do _not_ make install (or edit the images library paths in loadimages()
	before you do -- they are currently hardcoded to be in bitmaps/ in 
	the current directory and the 'game' will not work if they're not
	found there)

TODO: 
	*shrug* this is not great code. it was hacked in a night and should 
	probably be rewritten if it's going to be put to any serious work.
	it's only good for wasting time :) 
	
	may be (just may be) put isactive() in the control(2) library. i found
	it reasonable to use in several places.

	make a distinction between different mouse button clicks in control(2).
	if plan9 requires one to have a 3 button mouse i don't see why we should
	only be limited to button 1 in there :) (once again -- it could be me
	who cannot use the gui controls properly :)

	better images? the colorifying of minesweeper is in Forsyth's todo list
	too, but here it would be easier since the code uses image(6) to load 
	pictures. it'd be a simple matter of changing the files in bitmaps/ and 
	Cellsize in mines.c

	guessing and unguessing mines is not supported (see above -- single 
	mouse button problem)

	something else that i surely forgot...	

Implementation:
	each square on the grid is a button named X-Y where X and Y are
	the grid locations (starting from top-left).

	each button sends an event on the same channel, which is then
	handled in the main loop. rather naively.

	for each button there is a 'light' image, which is displayed when 
	the button is depressed. the light images are assigned based on 
	how many 'mines' are neighbouring the current cell. 

	the field is entirely predetermined before the game starts so 
	there is no monkeying around -- if you win you win... nothing...



Last Modified: May 26 2002
andrey@lanl.gov