1
Fork 0

Changes program options and output a bit

This commit is contained in:
Joshua Moerman 2014-02-18 16:12:51 +01:00
parent 9146cf168d
commit 4baca8241a

View file

@ -20,11 +20,11 @@ int main(int argc, char** argv){
// Describe program options // Describe program options
po::options_description opts; po::options_description opts;
opts.add_options() opts.add_options()
("w", po::value(&w), "width of puzzles") ("width,w", po::value(&w), "width of puzzles")
("h", po::value(&h), "height of puzzles") ("height,h", po::value(&h), "height of puzzles")
("c", po::value(&c), "number of colors") ("colors,c", po::value(&c), "number of colors")
("explosion_size", po::value(&explosion_size), "minimum explosion size") ("explosion_size", po::value(&explosion_size), "minimum explosion size")
("n", po::value(&n), "number of grids to test") ("sample_size,n", po::value(&n), "number of grids to test")
("verbose", po::bool_switch(), "prints a lot") ("verbose", po::bool_switch(), "prints a lot")
("help", po::bool_switch(), "show this help"); ("help", po::bool_switch(), "show this help");
@ -41,10 +41,6 @@ int main(int argc, char** argv){
bool verbose = vm["verbose"].as<bool>(); bool verbose = vm["verbose"].as<bool>();
#define OUT(x) std::cout << #x << " = " << x << "\n"
OUT(w); OUT(h); OUT(c); OUT(explosion_size);
#undef OUT
std::random_device rd; std::random_device rd;
std::mt19937 gen(rd()); std::mt19937 gen(rd());
@ -52,11 +48,11 @@ int main(int argc, char** argv){
int solvable = 0; int solvable = 0;
int unsolvable = 0; int unsolvable = 0;
while(--n){ while(n--){
auto field = random_dynamic_grid(w, h, c, gen); auto field = random_dynamic_grid(w, h, c, gen);
if(verbose){ if(verbose){
std::cout << "\n= puzzle " << n << " =\n"; std::cout << "= Puzzle " << n << " =\n";
field.print(std::cout); field.print(std::cout);
} }
@ -65,9 +61,6 @@ int main(int argc, char** argv){
++solvable; ++solvable;
if(verbose){ if(verbose){
std::cout << solution.solution_traces.size() << " solutions\n"; std::cout << solution.solution_traces.size() << " solutions\n";
for(auto&& t : solution.solution_traces[0]){
std::cout << "(" << t.first << ", " << t.second << ")\n";
}
} }
} else { } else {
++unsolvable; ++unsolvable;