Actual model
| 93 | public: |
| 94 | /// Actual model |
| 95 | MineSweeper(const SizeOptions& opt) |
| 96 | : Script(opt), spec(specs[opt.size()]), |
| 97 | size(spec_size(spec)), |
| 98 | b(*this,size*size,0,1) { |
| 99 | Matrix<BoolVarArray> m(b, size, size); |
| 100 | |
| 101 | // Initialize matrix and post constraints |
| 102 | for (int h=0; h<size; h++) |
| 103 | for (int w=0; w<size; w++) { |
| 104 | int v = mineField(spec, size, h, w); |
| 105 | if (v != -1) { |
| 106 | rel(*this, m(w, h), IRT_EQ, 0); |
| 107 | linear(*this, fieldsAround(m, w, h), IRT_EQ, v); |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | // Install branching |
| 112 | branch(*this, b, BOOL_VAR_NONE(), BOOL_VAL_MAX()); |
| 113 | } |
| 114 | |
| 115 | /// Print solution |
| 116 | virtual void |
nothing calls this directly
no test coverage detected