From 69b32fd4fd922fb25d41e83354c3d13ac2c2cbe1 Mon Sep 17 00:00:00 2001 From: Auric Vente Date: Sun, 21 Jul 2024 09:11:16 -0600 Subject: [PATCH] Mods --- cromulant/game.py | 16 ++++++++++++---- cromulant/utils.py | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/cromulant/game.py b/cromulant/game.py index ee109b4..c6cd908 100644 --- a/cromulant/game.py +++ b/cromulant/game.py @@ -22,6 +22,7 @@ from .settings import Settings class Game: timer: QTimer | None = None playing_song: bool = False + last_update: int = 0 @staticmethod def prepare() -> None: @@ -154,14 +155,21 @@ class Game: if not ant: return - num = random.randint(0, 12) + min_num = 0 + max_num = 12 - if num == 0: - Ants.merge() - return + num = random.randint(min_num, max_num) + + if num == min_num: + if Game.last_update == min_num: + num = max_num + else: + Ants.merge() + return status = "" method = "normal" + Game.last_update = num if num == 1: ant.triumph += 1 diff --git a/cromulant/utils.py b/cromulant/utils.py index 4acb91a..a14faaa 100644 --- a/cromulant/utils.py +++ b/cromulant/utils.py @@ -27,7 +27,7 @@ class Utils: Utils.rand_sentence = RandomSentence() @staticmethod - def now() -> float: + def now() -> int: return int(time.time()) @staticmethod