Mods
This commit is contained in:
parent
857f0a374f
commit
0d22a4280f
|
@ -98,12 +98,14 @@ class Ants:
|
||||||
Ants.populate(Config.default_population)
|
Ants.populate(Config.default_population)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def hatch(num: int = 1, on_change: bool = True) -> None:
|
def hatch(
|
||||||
|
num: int = 1, on_change: bool = True, ignore: list[str] | None = None
|
||||||
|
) -> None:
|
||||||
from .game import Game
|
from .game import Game
|
||||||
|
|
||||||
for _ in range(num):
|
for _ in range(num):
|
||||||
ant = Ant()
|
ant = Ant()
|
||||||
ant.name = Ants.random_name()
|
ant.name = Ants.random_name(ignore)
|
||||||
Ants.ants.append(ant)
|
Ants.ants.append(ant)
|
||||||
Game.update(ant)
|
Game.update(ant)
|
||||||
|
|
||||||
|
@ -184,8 +186,15 @@ class Ants:
|
||||||
Ants.hatch(num)
|
Ants.hatch(num)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def random_name() -> str:
|
def random_name(ignore: list[str] | None = None) -> str:
|
||||||
return Utils.random_name(Ants.get_names())
|
names = Ants.get_names()
|
||||||
|
|
||||||
|
if ignore:
|
||||||
|
for name in ignore:
|
||||||
|
if name not in names:
|
||||||
|
names.append(name)
|
||||||
|
|
||||||
|
return Utils.random_name(names)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_top_ant() -> tuple[Ant, int] | None:
|
def get_top_ant() -> tuple[Ant, int] | None:
|
||||||
|
@ -271,7 +280,7 @@ class Ants:
|
||||||
|
|
||||||
Ants.ants.append(ant)
|
Ants.ants.append(ant)
|
||||||
Game.update(ant)
|
Game.update(ant)
|
||||||
Ants.hatch()
|
Ants.hatch(ignore=[ant_1.name, ant_2.name])
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -280,9 +289,8 @@ class Ants:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def terminate(ant: Ant) -> None:
|
def terminate(ant: Ant) -> None:
|
||||||
Ants.hatch(on_change=False)
|
|
||||||
Ants.set_terminated(ant)
|
Ants.set_terminated(ant)
|
||||||
Ants.on_change()
|
Ants.hatch(ignore=[ant.name])
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def set_terminated(ant: Ant) -> None:
|
def set_terminated(ant: Ant) -> None:
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
convert $1 -channel G -evaluate add 12% +channel -quality 85 -strip $1_green
|
convert $1 -channel G -evaluate add 16% +channel -quality 85 -strip $1_green
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 268 KiB After Width: | Height: | Size: 268 KiB |
Loading…
Reference in New Issue