This commit is contained in:
Auric Vente 2024-07-21 02:12:35 -06:00
parent 5198660984
commit 0ecee9230e
2 changed files with 9 additions and 2 deletions

View File

@ -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()

View File

@ -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)