From b7508a766df991539bec5e10fd7739001c1fdb99 Mon Sep 17 00:00:00 2001 From: Frank Gevaerts Date: Tue, 15 Nov 2011 23:44:56 +0000 Subject: Don't put mines adjacent to the starting position instead of just not *on* the starting position. (FS#12387 by Ophir Lojkine) Since in minesweeper one needs information about at least two positions to deduce anything (unless the first position has no adjacent mines at all), having mines adjacent to the starting position means the player has to guess without any information, which is no different than having a chance that the first position already has a mine. I don't think minesweeper is meant to be a game of pure luck. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30994 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/minesweeper.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/plugins/minesweeper.c b/apps/plugins/minesweeper.c index b3effdf328..d8313fb741 100644 --- a/apps/plugins/minesweeper.c +++ b/apps/plugins/minesweeper.c @@ -523,7 +523,9 @@ static void minesweeper_init( void ) /* put mines on the mine field */ /* there is p% chance that a tile is a mine */ -/* if the tile has coordinates (x,y), then it can't be a mine */ +/* if the tile has coordinates (x,y), or is adjacent to those, + * then it can't be a mine because that would reduce the game + * from a logic game to a guessing game. */ static void minesweeper_putmines( int p, int x, int y ) { int i,j; @@ -533,7 +535,8 @@ static void minesweeper_putmines( int p, int x, int y ) { for( j = 0; j < width; j++ ) { - if( rb->rand()%100 < p && !( y==i && x==j ) ) + if( rb->rand()%100 < p + && !( i>=y-1 && i<=y+1 && j>=x-1 && j<=x+1 ) ) { minefield[i][j].mine = 1; mine_num++; -- cgit v1.2.3