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
This commit is contained in:
Frank Gevaerts 2011-11-15 23:44:56 +00:00
parent 3607d88aa0
commit b7508a766d

View file

@ -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++;