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

View File

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