Example: Minesweeper More...
Public Member Functions | |
MineSweeper (const SizeOptions &opt) | |
Actual model. | |
virtual void | print (std::ostream &os) const |
Print solution. | |
MineSweeper (MineSweeper &s) | |
Constructor for cloning s. | |
virtual Space * | copy (void) |
Copy space during cloning. | |
Public Member Functions inherited from Gecode::Driver::ScriptBase< Driver::IgnoreStepOption< Space > > | |
ScriptBase (const Options &opt) | |
Constructor. | |
ScriptBase (ScriptBase &e) | |
Constructor used for cloning. | |
virtual void | compare (const Space &home, std::ostream &os) const |
Compare with s. | |
Public Member Functions inherited from Gecode::Driver::IgnoreStepOption< BaseSpace > | |
IgnoreStepOption (const Options &) | |
Constructor. | |
IgnoreStepOption (BaseSpace &e) | |
Constructor used for cloning. |
Related Symbols | |
(Note that these are not member symbols.) | |
int | main (int argc, char *argv[]) |
Main-function. |
Minesweeper specifications | |
A specification is a square matrix of characters. Alphanumeric characters represent the number of mines adjacent to that field. Dots represent fields with an unknown number of mines adjacent to it (or an actual mine). | |
const char * | specs [] |
The specifications. | |
const unsigned int | n_examples = sizeof(specs)/sizeof(char*) |
Number of specifications. | |
int | spec_size (const char *s) |
Compute the size of a specification. | |
int | mineField (const char *s, int n, int i, int j) |
Return value at position (i,j) in the example s of size n. |
Additional Inherited Members | |
Static Public Member Functions inherited from Gecode::Driver::ScriptBase< Driver::IgnoreStepOption< Space > > | |
static std::ostream & | select_ostream (const char *sn, std::ofstream &ofs) |
Choose output stream according to sn. | |
static void | run (const Options &opt, Script *s=NULL) |
Example: Minesweeper
This is the classical MineSweeper game.
The instances are taken from http://www.janko.at/Raetsel/Minesweeper/index.htm
Definition at line 60 of file minesweeper.cpp.
|
inline |
Actual model.
Definition at line 95 of file minesweeper.cpp.
|
inline |
Constructor for cloning s.
Definition at line 135 of file minesweeper.cpp.
|
inlinevirtual |
Print solution.
Reimplemented from Gecode::Driver::ScriptBase< Driver::IgnoreStepOption< Space > >.
Definition at line 117 of file minesweeper.cpp.
|
inlinevirtual |
Copy space during cloning.
Definition at line 141 of file minesweeper.cpp.
|
The specifications.
Definition at line 179 of file minesweeper.cpp.
|
Number of specifications.
Definition at line 278 of file minesweeper.cpp.
|
Main-function.
Definition at line 152 of file minesweeper.cpp.
|
Compute the size of a specification.
Definition at line 281 of file minesweeper.cpp.
|
Return value at position (i,j) in the example s of size n.
Definition at line 288 of file minesweeper.cpp.