diff options
| author | thecharlesblake | 2018-02-23 21:26:31 +0000 |
|---|---|---|
| committer | thecharlesblake | 2018-02-23 21:26:31 +0000 |
| commit | 27972117db0feafd481d1a6907ef93752cd2226c (patch) | |
| tree | 74db6eaecd31cfb5f3c4e3a792c7f32da959da78 /src/main | |
| parent | Change next moves from list to vector (diff) | |
| download | metasol-27972117db0feafd481d1a6907ef93752cd2226c.tar.gz metasol-27972117db0feafd481d1a6907ef93752cd2226c.zip | |
Fix double call to gen legal moves in solver
Diffstat (limited to 'src/main')
| -rw-r--r-- | src/main/solver/solver.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/solver/solver.cpp b/src/main/solver/solver.cpp index 3542383..9f0e1f3 100644 --- a/src/main/solver/solver.cpp +++ b/src/main/solver/solver.cpp @@ -48,10 +48,11 @@ bool solver::run() { bool is_new_state = cache.insert(state); if (is_new_state) { // Gets the legal moves in the current state - vector<game_state::move> next_moves = state.get_legal_moves(); + vector<game_state::move> next_moves = + state.get_legal_moves(); // If there are none, reverts to the last node with children - if (state.get_legal_moves().empty()) { + if (next_moves.empty()) { states_exhausted = revert_to_last_node_with_children(); } else { add_children(next_moves); |
