public class MineSweeper extends ExampleFD
This is a port of Hakan's MiniZinc model http://www.hakank.org/minizinc/minesweeper.mzn
which is commented in the (swedish) blog post "Fler constraint programming-modeller i MiniZinc, t.ex. Minesweeper och Game of Life" http://www.hakank.org/webblogg/archives/001231.html
See also
The first 10 examples are from gecode/examples/minesweeper.cc http://www.gecode.org/gecode-doc-latest/minesweeper_8cc-source.html
http://www.janko.at/Raetsel/Minesweeper/index.htm
http://en.wikipedia.org/wiki/Minesweeper_(computer_game)
Ian Stewart on Minesweeper: http://www.claymath.org/Popular_Lectures/Minesweeper/
Richard Kaye's Minesweeper Pages: http://web.mat.bham.ac.uk/R.W.Kaye/minesw/minesw.htm
Some Minesweeper Configurations: http://web.mat.bham.ac.uk/R.W.Kaye/minesw/minesw.pdf
Modifier and Type | Field and Description |
---|---|
int[][] |
problem |
static int |
X
It represents the unknown value in the problem matrix.
|
Constructor and Description |
---|
MineSweeper() |
Modifier and Type | Method and Description |
---|---|
static void |
main(String[] args)
It executes the program to solve any MineSweeper problem.
|
void |
model()
It specifies a standard way of modeling the problem.
|
static String[] |
problem_kaye_splitter()
One of the possible MineSweeper problems.
|
static String[] |
problem1()
One of the possible MineSweeper problems.
|
static String[] |
problem10()
One of the possible MineSweeper problems.
|
static String[] |
problem2()
One of the possible MineSweeper problems.
|
static String[] |
problem3()
One of the possible MineSweeper problems.
|
static String[] |
problem4()
One of the possible MineSweeper problems.
|
static String[] |
problem5()
One of the possible MineSweeper problems.
|
static String[] |
problem6()
One of the possible MineSweeper problems.
|
static String[] |
problem7()
One of the possible MineSweeper problems.
|
static String[] |
problem8()
One of the possible MineSweeper problems.
|
static String[] |
problem9()
One of the possible MineSweeper problems.
|
static String[][] |
problems()
The collection of MineSweeper problems.
|
static String[] |
problemTest()
One of the possible MineSweeper problems.
|
static int[][] |
readFile(String file)
Reads a minesweeper file.
|
static int[][] |
readFromArray(String[] description)
It transforms string representation of the problem into an array of ints
representation.
|
void |
searchSpecific(boolean recordSolutions)
It executes special search with solution printing to present the solutions.
|
creditSearch, getSearch, getSearchVariables, getStore, printMatrix, search, searchAllAtOnce, searchAllOptimal, searchLDS, searchMasterSlave, searchMaxRegretOptimal, searchMiddle, searchMostConstrainedStatic, searchOptimal, searchSmallestDomain, searchSmallestMedian, searchSmallestMiddle, searchSmallestMin, searchWeightedDegree, searchWithMaxRegret, searchWithRestarts, shavingSearch
public static final int X
public int[][] problem
public void model()
ExampleFD
public void searchSpecific(boolean recordSolutions)
recordSolutions
- specifies if the solutions should be recorded.public static int[][] readFromArray(String[] description)
description
- array of strings representing the problem.public static final String[] problem1()
public static final String[] problem2()
public static final String[] problem3()
public static final String[] problem4()
public static final String[] problem5()
public static final String[] problem6()
public static final String[] problem7()
public static final String[] problem8()
public static final String[] problem9()
public static final String[] problem10()
public static final String[] problemTest()
public static final String[] problem_kaye_splitter()
public static final String[][] problems()
public static int[][] readFile(String file)
0..8 means number of neighbours, "." mean unknown (may be a mine)
Example (from minesweeper0.txt) # Problem from Gecode/examples/minesweeper.cc problem 0 6 6 ..2.3. 2..... ..24.3 1.34.. .....3 .3.3..
file
- it specifies the filename containing the problem description.public static void main(String[] args)
args
- the filename containing the problem description.Copyright © 2022. All rights reserved.