MySweeper Rules
Version 1.08

Symbols and Terms For Rules

Each cell is surrounded by at most eight other cells. Relative to these adjacent cells, each cell has associated with it the following fields:

ADJMINE # Adjacent mines (fixed at start of each game)
ADJFLAG # Adjacent cells marked with a flag
ADJEXPO # Adjacent exposed cells
ADJUNEX # Adjacent unexposed/unflagged cells
REST = ADJMINE - ADJFLAG # still buried mines
Note: ADJFLAG + ADJEXPO + ADJUNEX = 8
Rn The 3 x 3 rectangle surrounding cell n.
Rn INT Rm Set of cells formed by intersection of Rn and Rm (this set is also a rectangle, possibly empty)
#Rn Number of unexposed and unflagged cells in Rn
Rn \ Rm Set of cells in Rn but not in Rm (this set is not necessarily a rectangle)

Legend:

MySweeper Blank Cell = unexposed
MySweeper Checked Cell = unexposed, but we know is a blank
MySweeper Red X = unexposed, but we know is a mine.
MySweeper Flagged Cell = flagged as a mine

Implemented Rules

MySweeper implements one-level rules, not transitive cases. That is, it doesn't act upon hints, only exposed cells and (possibly incorrectly) flagged cells. However, throughout this discussion, it is assumed that there are no incorrectly flagged cells.

1.  Prose: If an exposed cell has all its adjacent mines flagged, the remaining unexposed cells are empty.
Technical: If for any exposed cell, ADJMINE == ADJFLAG, then none of the ADJUNEX cells are mines.
Example: In the following configuration, the cells marked with a MySweeper Checked Cell are known to be blank:

MySweeper Example #1
2.  Prose: If an unexposed cell has the same number of unexposed adjacent cells as there are unexposed mines, the remaining unexposed cells are all mines.
Technical: If for any exposed cell, ADJMINE == (ADJFLAG + ADJUNEX), then all of the ADJUNEX cells are mines.
Example: In the following configuration, the cells marked with a MySweeper Red X are known to be mines:

MySweeper Example #2
3.  Prose: If the unexposed cells surrounding cell #1 are a subset of the unexposed cells surrounding cell #2, and they have the same number of still buried (unflagged) mines, then none of the unexposed cells in R2 \ R1 are mines.
Technical: Relative to the original cell(#1), for any exposed (within two cell radius) cells(#2) other than the current cell(#1)
If (#(R2 INT R1) == #R1
   && REST1 == REST2)
Then all of the unexposed and unflagged cells in R2 \ R1 are blank.
Example: In the following configuration, the cells marked with a MySweeper Checked Cell are known to be blank:

MySweeper Example #3
4.  Prose: If the still buried mines around cell #1 are fewer than the number of unexposed unflagged cells common to R2 and R1, and the difference between the number of unflagged mines between the two cells is the same as the number of unexposed unflagged cells in R2 \ R1, then all of the unexposed cells in R2 \ R1 are mines.
Technical: Relative to the original cell(#1), for any exposed (within two cell radius) cells(#2) other than the current cell(#1)

If (REST1 < #(R2 INT R1)
   && (REST2 - REST1) == #(R2 \ R1))

Then all of the unexposed and unflagged cells in R2 \ R1 are mines and none of the unexposed and unflagged cells in R1 \ R2 are mines.
Example: In the following configuration, the cells marked with a MySweeper Red X are known to be mines, and the cells marked with a MySweeper Checked Cell are known to be blanks:

MySweeper Example #4

Unimplemented Rules

5. 

The program does not as yet handle the following case:

MySweeper Example #5

In this case, the MySweeper #2 in Cell on the bottom means that the two MySweeper Blank Cells to its left and above left contain one mine. This means that the two MySweeper Blank Cells above and to the above left of the MySweeper #4 in Cell also contain one mine. Finally, the MySweeper #2 in Cell at the top left absorbs this last mine and thus the cells marked MySweeper Checked Cell are blanks. To handle this, likely we need to recurse at each stage, or as has been suggested by Dave Rusin (), solve a set of simultaneous linear equations.

6. 

For the moment, no endgame rules have been implemented. For example

MySweeper Example #6

If there's only one mine remaining, it's the cell marked MySweeper Red X. Using Dave Rusin's scheme this can be accomplished with one more simultaneous linear equation.

Valid XHTML 1.0! Valid CSS!
GetNARS2000!
NARS2000
© 2006-2020
Get GPL v3!   Get Firefox!   Get Thunderbird!   Get LibreOffice!   I Support Science!
Comments or suggestions? Send them to .