Mods
This commit is contained in:
parent
b1260f894a
commit
9a2c1bdcc5
|
@ -90,6 +90,12 @@ class Ants:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def prepare() -> None:
|
def prepare() -> None:
|
||||||
Ants.get()
|
Ants.get()
|
||||||
|
Ants.check()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def check() -> None:
|
||||||
|
if not Ants.ants:
|
||||||
|
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) -> None:
|
||||||
|
|
|
@ -53,6 +53,7 @@ class Config:
|
||||||
countries_json: Path
|
countries_json: Path
|
||||||
filter_width: int = 150
|
filter_width: int = 150
|
||||||
filter_debouncer_delay: int = 200
|
filter_debouncer_delay: int = 200
|
||||||
|
default_population: int = 100
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def prepare() -> None:
|
def prepare() -> None:
|
||||||
|
|
|
@ -287,8 +287,15 @@ class Game:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def restart() -> None:
|
def restart() -> None:
|
||||||
opts = ["25", "50", "100", "250"]
|
opts = ["25", "50", "100", "250"]
|
||||||
|
defindex = 0
|
||||||
|
|
||||||
|
for i, opt in enumerate(opts):
|
||||||
|
if int(opt) == Config.default_population:
|
||||||
|
defindex = i
|
||||||
|
break
|
||||||
|
|
||||||
opts = [f"{opt} ants" for opt in opts]
|
opts = [f"{opt} ants" for opt in opts]
|
||||||
size = Window.prompt_combobox("Size of the population", opts, 2)
|
size = Window.prompt_combobox("Size of the population", opts, defindex)
|
||||||
|
|
||||||
if not size:
|
if not size:
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue