diff options
Diffstat (limited to 'src/main/solver/solver.cpp')
| -rw-r--r-- | src/main/solver/solver.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/main/solver/solver.cpp b/src/main/solver/solver.cpp index 19fa79b..072db18 100644 --- a/src/main/solver/solver.cpp +++ b/src/main/solver/solver.cpp @@ -16,7 +16,7 @@ using namespace std; using namespace boost; solver::solver(const game_state& gs) - : initial_state(gs), states_searched(0) {} + : cache(gs), initial_state(gs), states_searched(0) {} solver::node::node(const game_state::move m, vector<game_state::move> uc) @@ -30,7 +30,7 @@ bool solver::run() { states_searched++; LOG_DEBUG (state); frontier.emplace_back(game_state::move(0,0), state.get_legal_moves()); - cache.insert(state); + cache.insert(state.get_data()); while (!frontier.empty()) { node& current = frontier.back(); @@ -47,7 +47,7 @@ bool solver::run() { // (unless it's the null first move) if (frontier.size() > 1) { state.undo_move(current.move); - assert(cache.contains(state)); + assert(cache.contains(state.get_data())); LOG_DEBUG (state); } // Returns to the previous state @@ -60,7 +60,7 @@ bool solver::run() { state.make_move(next_move); // Insert the state into the global cache - bool is_new_state = cache.insert(state); + bool is_new_state = cache.insert(state.get_data()); if (is_new_state) { states_searched++; LOG_DEBUG (state); @@ -70,7 +70,7 @@ bool solver::run() { } else { // If we've seen the state before, undoes the move state.undo_move(next_move); - assert(cache.contains(state)); + assert(cache.contains(state.get_data())); } } } |
