diff --git a/cromulant/game.py b/cromulant/game.py index 3626862..0d0d05f 100644 --- a/cromulant/game.py +++ b/cromulant/game.py @@ -180,7 +180,7 @@ class Game: ant.hits += 1 method = "hit" elif num == 3: - status = Utils.random_name([]) + status = Utils.random_name([], Ants.get_names()) method = "thinking" elif num == 4: status = Utils.rand_sentence.simple_sentence() diff --git a/cromulant/utils.py b/cromulant/utils.py index 188ea98..4acb91a 100644 --- a/cromulant/utils.py +++ b/cromulant/utils.py @@ -93,7 +93,14 @@ class Utils: return r, g, b @staticmethod - def random_name(ignore: list[str]) -> str: + def random_name(ignore: list[str], include: list[str] | None = None) -> str: + names = Utils.names + + if include: + for name in include: + if name not in names: + names.append(name) + filtered = [name for name in Utils.names if name not in ignore] return random.choice(filtered)