From 4c2a8edb7c35a42a5fcf72507079a2d3476308cf Mon Sep 17 00:00:00 2001 From: Auric Vente Date: Sun, 21 Jul 2024 23:15:09 -0600 Subject: [PATCH] Mods --- cromulant/config.py | 1 + cromulant/game.py | 19 +++++++------------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/cromulant/config.py b/cromulant/config.py index d273762..350f5cc 100644 --- a/cromulant/config.py +++ b/cromulant/config.py @@ -54,6 +54,7 @@ class Config: filter_width: int = 150 filter_debouncer_delay: int = 200 default_population: int = 100 + merge_goal: int = 8 @staticmethod def prepare() -> None: diff --git a/cromulant/game.py b/cromulant/game.py index 51d958c..f9cd356 100644 --- a/cromulant/game.py +++ b/cromulant/game.py @@ -34,7 +34,7 @@ class Method: class Game: timer: QTimer | None = None playing_song: bool = False - last_update: int = 0 + merge_charge: int = 0 @staticmethod def prepare() -> None: @@ -169,22 +169,17 @@ class Game: min_num = 0 max_num = 12 - no_repeat = [Method.merge] num = random.randint(min_num, max_num) - - if num in no_repeat: - if Game.last_update == num: - num = max_num - - Game.last_update = num + Game.merge_charge += 1 if num == Method.merge: - if Ants.merge(): - return + if Game.merge_charge >= Config.merge_goal: + if Ants.merge(): + Game.merge_charge = 0 + return - # If merge failed - num = max_num + num = min_num status = "" method = "normal"