From 2b3e92a384c2483d88f48c8fcafe8ffcdfb0f3b3 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Sun, 12 Nov 2017 11:41:28 +0000 Subject: Simplify is_solved() --- src/main/game/game_state.cpp | 5 +---- src/main/game/game_state.h | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) (limited to 'src/main') 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 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; -- cgit v1.2.1