diff options
author | 2021-07-08 16:56:15 -0400 | |
---|---|---|
committer | 2021-07-09 14:02:38 -0400 | |
commit | 0b659a6e398c690b8f6f97e62751c921efacb5d9 (patch) | |
tree | 14f26ef1998923eaf88ea5406e9e25e86e507dc3 | |
parent | Add function to end the game (diff) |
Define minimum solutions distribution
-rw-r--r-- | bot/exts/evergreen/duck_game.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/bot/exts/evergreen/duck_game.py b/bot/exts/evergreen/duck_game.py index 55a57bb6..62c8075c 100644 --- a/bot/exts/evergreen/duck_game.py +++ b/bot/exts/evergreen/duck_game.py @@ -22,6 +22,12 @@ INCORRECT_SOLN = -1 CORRECT_GOOSE = 2 INCORRECT_GOOSE = -1 +""" Distribution of minimum acceptable solutions at board generation. + This is for gameplay reasons, to shift the number of solutions per board up, + while still making the end of the game unpredictable. +""" +SOLN_DISTR = 0, 0.05, 0.1, 0.1, 0.15, 0.2, 0.2, 0.15, .05 + p = Path("bot", "resources", "evergreen", "all_cards.png") ALL_CARDS = Image.open(p) CARD_WIDTH = 155 @@ -104,7 +110,7 @@ class DuckGame: @board.setter def board(self, val: list[tuple[int]]) -> None: """Erases calculated solutions if the board changes.""" - self._solution = None + self._solutions = None self._board = val @property @@ -154,7 +160,8 @@ class DuckGamesDirector(commands.Cog): if ctx.channel.id in self.current_games: return - game = DuckGame() + minimum_solutions, = random.choices(range(len(SOLN_DISTR)), weights=SOLN_DISTR) + game = DuckGame(minimum_solutions=minimum_solutions) game.running = True self.current_games[ctx.channel.id] = game |