You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdegames/kmines/solver/testSolve.cpp

34 lines
651 B

/** 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);
field.reset(W, H, M);
Solver solver;
if( !solver.solveOneStep(field) ) cout << "OOPS!!" << endl;
else cout << "Solved!" << endl;
cout << field << endl;
return 0;
}