aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorthecharlesblake2018-02-23 21:26:31 +0000
committerthecharlesblake2018-02-23 21:26:31 +0000
commit27972117db0feafd481d1a6907ef93752cd2226c (patch)
tree74db6eaecd31cfb5f3c4e3a792c7f32da959da78 /src/main
parentChange next moves from list to vector (diff)
downloadmetasol-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.cpp5
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);