aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharlie Blake2018-08-08 17:16:36 +0100
committerGitHub2018-08-08 17:16:36 +0100
commita1c593df9954f2eeb2cc28edba3e89b2a657cb96 (patch)
treea6a876c7a11fd47673af1dfa56335f2763403dde /src
parentMerge pull request #82 from thecharlesblake/two-deck-testing (diff)
parentPrint seed ofter runing solver (diff)
downloadmetasol-a1c593df9954f2eeb2cc28edba3e89b2a657cb96.tar.gz
metasol-a1c593df9954f2eeb2cc28edba3e89b2a657cb96.zip

Merge pull request #83 from thecharlesblake/fix-write-out-bugs

Fix write out bugs

Diffstat (limited to 'src')
-rw-r--r--src/main/game/global_cache.cpp2
-rw-r--r--src/main/main.cpp5
-rw-r--r--src/main/solver/solver.h12
3 files changed, 10 insertions, 9 deletions
diff --git a/src/main/game/global_cache.cpp b/src/main/game/global_cache.cpp
index 90d962d..f1cf185 100644
--- a/src/main/game/global_cache.cpp
+++ b/src/main/game/global_cache.cpp
@@ -217,7 +217,9 @@ pair<item_list::iterator, bool> lru_cache::insert(const game_state& gs) {
cache.relocate(cache.begin(), prev(cache.end()));
if (i == max_num_items) {
+#ifndef NDEBUG
LOG_ERROR("All items in cache are live and cache is full");
+#endif
throw runtime_error("All items in cache are live and cache is full");
}
}
diff --git a/src/main/main.cpp b/src/main/main.cpp
index 073cabd..ff03669 100644
--- a/src/main/main.cpp
+++ b/src/main/main.cpp
@@ -97,9 +97,7 @@ const optional<sol_rules> gen_rules(command_line_helper& clh) {
}
void solve_random_game(int seed, const sol_rules& rules, command_line_helper& clh) {
- if (clh.get_classify())
- cout << seed;
- else
+ if (!clh.get_classify())
LOG_INFO ("Attempting to solve with seed: " << seed << "...");
solve_game(rules, clh, seed, none);
}
@@ -145,6 +143,7 @@ void solve_game(const sol_rules& rules, command_line_helper& clh, optional<int>
: optional<solve_sol>();
if (clh.get_classify()) {
+ if (seed) cout << *seed;
solver::print_result_csv(solution.second);
if (smart) {
if (run_again) {
diff --git a/src/main/solver/solver.h b/src/main/solver/solver.h
index b4cd105..6b5704e 100644
--- a/src/main/solver/solver.h
+++ b/src/main/solver/solver.h
@@ -29,15 +29,15 @@ public:
enum class type { TIMEOUT, SOLVED, UNSOLVABLE, MEM_LIMIT };
type sol_type;
- int states_searched;
- int unique_states_searched;
- int backtracks;
- int dominance_moves;
+ uint64_t states_searched;
+ uint64_t unique_states_searched;
+ uint64_t backtracks;
+ uint64_t dominance_moves;
uint64_t states_removed_from_cache;
lru_cache::item_list::size_type cache_size;
lru_cache::item_list::size_type cache_bucket_count;
- int max_depth;
- int depth;
+ uint64_t max_depth;
+ uint64_t depth;
std::chrono::milliseconds time;
};