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.tar.gz rockbox-b7508a766df991539bec5e10fd7739001c1fdb99.zip |
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 b3effdf328..d8313fb741 100644 --- a/apps/plugins/minesweeper.c +++ b/apps/plugins/minesweeper.c | |||
@@ -523,7 +523,9 @@ static void minesweeper_init( void ) | |||
523 | 523 | ||
524 | /* put mines on the mine field */ | 524 | /* put mines on the mine field */ |
525 | /* there is p% chance that a tile is a mine */ | 525 | /* there is p% chance that a tile is a mine */ |
526 | /* if the tile has coordinates (x,y), then it can't be a mine */ | 526 | /* if the tile has coordinates (x,y), or is adjacent to those, |
527 | * then it can't be a mine because that would reduce the game | ||
528 | * from a logic game to a guessing game. */ | ||
527 | static void minesweeper_putmines( int p, int x, int y ) | 529 | static void minesweeper_putmines( int p, int x, int y ) |
528 | { | 530 | { |
529 | int i,j; | 531 | int i,j; |
@@ -533,7 +535,8 @@ static void minesweeper_putmines( int p, int x, int y ) | |||
533 | { | 535 | { |
534 | for( j = 0; j < width; j++ ) | 536 | for( j = 0; j < width; j++ ) |
535 | { | 537 | { |
536 | if( rb->rand()%100 < p && !( y==i && x==j ) ) | 538 | if( rb->rand()%100 < p |
539 | && !( i>=y-1 && i<=y+1 && j>=x-1 && j<=x+1 ) ) | ||
537 | { | 540 | { |
538 | minefield[i][j].mine = 1; | 541 | minefield[i][j].mine = 1; |
539 | mine_num++; | 542 | mine_num++; |