diff options
| author | thecharlesblake | 2018-01-30 15:50:35 +0000 |
|---|---|---|
| committer | thecharlesblake | 2018-01-30 15:50:35 +0000 |
| commit | 375a45f4a2ecc17b1e77816b1e2192f15816d362 (patch) | |
| tree | 8eaaa396e92c752d80b361a6b858a378a7a524d1 /src/main/solver/solver.cpp | |
| parent | Make deal parser use new gs.place_card() method (diff) | |
| download | metasol-375a45f4a2ecc17b1e77816b1e2192f15816d362.tar.gz metasol-375a45f4a2ecc17b1e77816b1e2192f15816d362.zip | |
Update solver: cache uses game state not pile vec
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 072db18..6dddfb4 100644 --- a/src/main/solver/solver.cpp +++ b/src/main/solver/solver.cpp @@ -24,13 +24,13 @@ solver::node::node(const game_state::move m, } bool solver::run() { - ProfilerStart("solvitaire"); + //ProfilerStart("solvitaire"); game_state state = initial_state; states_searched++; LOG_DEBUG (state); frontier.emplace_back(game_state::move(0,0), state.get_legal_moves()); - cache.insert(state.get_data()); + cache.insert(state); 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.get_data())); + assert(cache.contains(state)); 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.get_data()); + bool is_new_state = cache.insert(state); 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.get_data())); + assert(cache.contains(state)); } } } |
