This commit is contained in:
Auric Vente
2024-07-19 00:54:22 -06:00
parent 95bc45af8b
commit 2b965b3435
4 changed files with 72 additions and 9 deletions

View File

@@ -26,6 +26,7 @@ class Game:
@staticmethod
def prepare() -> None:
Game.initial_fill()
Game.update_info()
@staticmethod
def add_status(ant: Ant) -> None:
@@ -145,7 +146,8 @@ class Game:
ants = sorted(Ants.ants, key=lambda ant: ant.updated)
for ant in ants:
Game.add_status(ant)
if ant.status:
Game.add_status(ant)
@staticmethod
def start_loop() -> None:
@@ -166,3 +168,28 @@ class Game:
def update_speed() -> None:
Game.timer.stop()
Game.start_loop()
@staticmethod
def update_info() -> None:
text = []
# Non-breaking space
nb = "\u00a0"
if not len(Ants.ants):
text.append("Hatch some ants")
else:
text.append(f"Ants:{nb}{len(Ants.ants)}")
hits = Ants.most_hits()
if hits:
text.append(f"Most{nb}Hits:{nb}{hits.name}")
triumph = Ants.most_triumph()
if triumph:
text.append(f"Most{nb}Triumph:{nb}{triumph.name}")
Window.info.setText(" | ".join(text))
Window.info.adjustSize()