aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Harley2019-02-25 14:49:54 +0000
committerTom Harley2019-02-25 14:49:54 +0000
commit1f9089849f964b28158144fce2d053149cf8a312 (patch)
tree4d1983caf02a51d1d0d9b5d135b323ee1afb8561
parentAdd documentation for metasol.hpp (diff)
downloadmetasol-1f9089849f964b28158144fce2d053149cf8a312.tar.gz
metasol-1f9089849f964b28158144fce2d053149cf8a312.zip

Check for majority moves after regular move

Previously, majority moves were checked for before regular moves. This would usually result in time wasted after a reveal-reset.

-rw-r--r--metasol.cpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/metasol.cpp b/metasol.cpp
index 6dd1047..4b96f97 100644
--- a/metasol.cpp
+++ b/metasol.cpp
@@ -819,20 +819,6 @@ solve_status run_loop(ms_game_state *gs, ms_rules *r, ms_settings *s,
ms_move m;
/*
- * If a majority of voters already agree on a move, running other voters is
- * a waste of time.
- */
- bool mm = false;
- while (find_majority_move(votes, vote_count, &m)) {
- mm = true;
- debug("majority move found\n");
- move_decided(gs, r, &m, votes, vote_count);
- }
- if (mm) {
- return loop_check(gs, r, s);
- }
-
- /*
* Set up the thread_info structs and add a job to the threadpool for each
* one.
*/
@@ -866,6 +852,16 @@ solve_status run_loop(ms_game_state *gs, ms_rules *r, ms_settings *s,
if (find_modal_move(votes, vote_count, &m)) {
move_decided(gs, r, &m, votes, vote_count);
}
+
+ /*
+ * If a majority of voters already agree on a move, running other voters is
+ * a waste of time.
+ */
+ while (find_majority_move(votes, vote_count, &m)) {
+ debug("majority move found\n");
+ move_decided(gs, r, &m, votes, vote_count);
+ }
+
return loop_check(gs, r, s);
}