From 4ef099051632a9fe6a74cef064d3ef3036ed77dc Mon Sep 17 00:00:00 2001 From: Auric Vente Date: Fri, 19 Jul 2024 22:21:58 -0600 Subject: [PATCH] Mods --- cromulant/ants.py | 6 +++++- cromulant/game.py | 5 ++--- cromulant/utils.py | 7 ++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cromulant/ants.py b/cromulant/ants.py index 4e08afb..d606248 100644 --- a/cromulant/ants.py +++ b/cromulant/ants.py @@ -74,7 +74,7 @@ class Ants: ant = Ant() ant.created = now ant.updated = now - ant.name = Utils.random_name() + ant.name = Ants.random_name() Ants.ants.append(ant) image_path = Config.hatched_image_path @@ -180,3 +180,7 @@ class Ants: return None return max(Ants.ants, key=lambda a: a.triumph) + + @staticmethod + def random_name() -> str: + return Utils.random_name(Ants.get_names()) diff --git a/cromulant/game.py b/cromulant/game.py index f7e424b..5eee6e7 100644 --- a/cromulant/game.py +++ b/cromulant/game.py @@ -162,9 +162,8 @@ class Game: elif num == 2: ant.hits += 1 method = "hit" - elif (num == 3) and (num_ants > 1): - other = Ants.get_other(ant) - status = other.name + elif num == 3: + status = Utils.random_name([ant.name]) method = "thinking" elif num == 4: status = s.simple_sentence() diff --git a/cromulant/utils.py b/cromulant/utils.py index e2a15f6..5730b45 100644 --- a/cromulant/utils.py +++ b/cromulant/utils.py @@ -86,11 +86,8 @@ class Utils: return r, g, b @staticmethod - def random_name() -> str: - from .ants import Ants - - used = Ants.get_names() - filtered = [name for name in Utils.names if name not in used] + def random_name(ignore: list[str]) -> str: + filtered = [name for name in Utils.names if name not in ignore] return random.choice(filtered) @staticmethod