aboutsummaryrefslogtreecommitdiff
path: root/src/main/game
diff options
context:
space:
mode:
authorthecharlesblake2017-11-12 11:41:28 +0000
committerthecharlesblake2017-11-12 11:41:28 +0000
commit2b3e92a384c2483d88f48c8fcafe8ffcdfb0f3b3 (patch)
tree5e9fd865816eeb21e8fbf0ae89da6a1d1d27349d /src/main/game
parentClean up deal from shuffled deck (diff)
downloadmetasol-2b3e92a384c2483d88f48c8fcafe8ffcdfb0f3b3.tar.gz
metasol-2b3e92a384c2483d88f48c8fcafe8ffcdfb0f3b3.zip

Simplify is_solved()

Diffstat (limited to 'src/main/game')
-rw-r--r--src/main/game/game_state.cpp5
-rw-r--r--src/main/game/game_state.h1
2 files changed, 1 insertions, 5 deletions
diff --git a/src/main/game/game_state.cpp b/src/main/game/game_state.cpp
index 4caf9d9..8105cb3 100644
--- a/src/main/game/game_state.cpp
+++ b/src/main/game/game_state.cpp
@@ -214,10 +214,7 @@ bool game_state::is_solved() const {
}
}
- if (rules.hole && hole.size() != rules.max_rank * 4) {
- return false;
- }
- return true;
+ return !rules.hole || hole.size() == rules.max_rank * 4;
}
ostream& game_state::print(ostream& stream) const {
diff --git a/src/main/game/game_state.h b/src/main/game/game_state.h
index b985924..26d2650 100644
--- a/src/main/game/game_state.h
+++ b/src/main/game/game_state.h
@@ -23,7 +23,6 @@ public:
game_state(int seed, const sol_rules&);
std::vector<game_state> get_next_legal_states() const;
- // NOTE: will only be evaluated after get_next_legal_states() is called
bool is_solved() const;
std::ostream& print(std::ostream&) const;