blob: e7a4c8c12b215a264c643598d0f2248a698df99a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
/** A program to test advisory library */
#include <assert.h>
#include <time.h>
#include "bfield.h"
#include "solver.h"
#include "headerP.h"
int main(int argc, char *argv[])
{
if ( argc!=4 )
tqFatal("Arguments: width height nbMines");
long seed = time(0);
cout << "seed = " << seed << endl;
short W, H, M;
W = atoi(argv[1]); assert(W > 0);
H = atoi(argv[2]); assert(H > 0);
M = atoi(argv[3]); assert(M >= 0); // ;)
BaseField field(seed);
Solver solver;
int i, solved = 0;
for(i=0;i<1000;++i){
field.reset(W, H, M);
if( !solver.solveOneStep(field)){
cout << "OOPS!!" << endl;
cout << field << endl;
} else ++solved;
cout << "Tried " << i+1 << ", solved " << solved << endl;
}
cout << "Solved total: " << solved << endl;
return 0;
}
|