diff options
| author | Frank Gevaerts <frank@gevaerts.be> | 2011-11-15 23:44:56 +0000 |
|---|---|---|
| committer | Frank Gevaerts <frank@gevaerts.be> | 2011-11-15 23:44:56 +0000 |
| commit | b7508a766df991539bec5e10fd7739001c1fdb99 (patch) | |
| tree | 31f77d4f20dec11934cce165c9340cc03367b2a2 /apps/plugins/minesweeper.c | |
| parent | 3607d88aa0371b047464b98690fead9c9b88b1e3 (diff) | |
| download | rockbox-b7508a766df991539bec5e10fd7739001c1fdb99.zip rockbox-b7508a766df991539bec5e10fd7739001c1fdb99.tar.gz rockbox-b7508a766df991539bec5e10fd7739001c1fdb99.tar.bz2 rockbox-b7508a766df991539bec5e10fd7739001c1fdb99.tar.xz | |
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
Diffstat (limited to 'apps/plugins/minesweeper.c')
| -rw-r--r-- | apps/plugins/minesweeper.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/apps/plugins/minesweeper.c b/apps/plugins/minesweeper.c index b3effdf..d8313fb 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++; |