aboutsummaryrefslogtreecommitdiff
path: root/src/main/main.cpp
diff options
context:
space:
mode:
authorthecharlesblake2018-04-09 19:14:34 +0100
committerthecharlesblake2018-04-09 19:14:34 +0100
commit7b37110a67cdf6add945224915ebae7817fa444c (patch)
tree68dbb8ceafadeaefa3be7d897c6b3d4d018ea3ca /src/main/main.cpp
parentMerge pull request #57 from thecharlesblake/local-results (diff)
downloadmetasol-7b37110a67cdf6add945224915ebae7817fa444c.tar.gz
metasol-7b37110a67cdf6add945224915ebae7817fa444c.zip

fin

Diffstat (limited to 'src/main/main.cpp')
-rw-r--r--src/main/main.cpp31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/main/main.cpp b/src/main/main.cpp
index a8080d5..6d06f5d 100644
--- a/src/main/main.cpp
+++ b/src/main/main.cpp
@@ -120,27 +120,38 @@ void solve_input_files(const vector<string> input_files, const sol_rules& rules,
void solve_game(const game_state& gs, bool short_sol, bool classify) {
solver s(gs);
solver* solv = &s;
- bool solution;
if (short_sol) {
uint bound = 1;
solver::sol_state ss;
+ bool solution = false;
do {
LOG_INFO("Depth: " << bound);
solver s_(gs);
solv = &s_;
ss = s_.run_with_cutoff(none, bound++);
+
+ if (ss == solver::sol_state::solved) {
+ if (!classify) solv->print_solution();
+ cout << "Solved\n";
+ solution = true;
+ }
} while (ss == solver::sol_state::cutoff);
- solution = ss == solver::sol_state::solved;
- } else {
- solution = solv->run() == solver::sol_state::solved;
- }
- if (solution) {
- if (!classify) solv->print_solution();
- cout << "Solved\n";
+ if (!solution) {
+ if (!classify) cout << "Deal:\n" << gs << "\n";
+ cout << "No Possible Solution\n";
+ }
+
} else {
- if (!classify) cout << "Deal:\n" << gs << "\n";
- cout << "No Possible Solution\n";
+ bool solution = solv->run() == solver::sol_state::solved;
+
+ if (solution) {
+ if (!classify) solv->print_solution();
+ cout << "Solved\n";
+ } else {
+ if (!classify) cout << "Deal:\n" << gs << "\n";
+ cout << "No Possible Solution\n";
+ }
}
cout << "States Searched: " << solv->get_states_searched() << "\n";