This commit is contained in:
Auric Vente 2024-07-21 22:22:30 -06:00
parent 0f7a5addee
commit f496ca6c4e
2 changed files with 12 additions and 12 deletions

View File

@ -105,7 +105,7 @@ class Ants:
ant = Ant()
ant.name = Ants.random_name()
Ants.ants.append(ant)
Game.add_update(ant)
Game.update(ant)
if on_change:
Ants.on_change()
@ -115,7 +115,7 @@ class Ants:
from .game import Game
Ants.save()
Game.update_info()
Game.info()
@staticmethod
def random_ant(ignore: list[Ant] | None = None) -> Ant | None:
@ -165,8 +165,8 @@ class Ants:
ant.method = method
ant.updated = Utils.now()
Game.add_update(ant)
Game.update_info()
Game.update(ant)
Game.info()
Ants.save()
@staticmethod
@ -270,7 +270,7 @@ class Ants:
ant.hits = ant_1.hits + ant_2.hits
Ants.ants.append(ant)
Game.add_update(ant)
Game.update(ant)
Ants.hatch()
return True
@ -289,5 +289,5 @@ class Ants:
from .game import Game
ant.method = "terminated"
Game.add_update(ant)
Game.update(ant)
Ants.ants.remove(ant)

View File

@ -38,11 +38,11 @@ class Game:
@staticmethod
def prepare() -> None:
Game.initial_fill()
Game.update_info()
Game.fill()
Game.info()
@staticmethod
def add_update(
def update(
ant: Ant,
) -> None:
container = QHBoxLayout()
@ -224,14 +224,14 @@ class Game:
Ants.set_status(ant, status, method)
@staticmethod
def initial_fill() -> None:
def fill() -> None:
if not len(Ants.ants):
return
ants = sorted(Ants.ants, key=lambda ant: ant.updated)
for ant in ants:
Game.add_update(ant)
Game.update(ant)
@staticmethod
def start_loop() -> None:
@ -264,7 +264,7 @@ class Game:
Game.start_loop()
@staticmethod
def update_info() -> None:
def info() -> None:
text = []
# Non-breaking space