Compare commits

..

3 Commits

Author SHA1 Message Date
Auric Vente
5057dfdeb0 Method weight args 2024-08-17 13:10:32 -06:00
Auric Vente
9e2212293d Method weight args 2024-08-16 15:22:03 -06:00
Auric Vente
276da493f4 Mods 2024-08-03 06:37:03 -06:00
4 changed files with 72 additions and 7 deletions

View File

@@ -29,6 +29,12 @@ class Args:
score: bool = False
mono: bool = False
fade: bool = True
weight_merge: int = 1
weight_triumph: int = 2
weight_hit: int = 2
weight_travel: int = 2
weight_think: int = 2
weight_words: int = 4
@staticmethod
def prepare() -> None:
@@ -62,6 +68,12 @@ class Args:
"argdoc",
"score",
"mono",
"weight_merge",
"weight_triumph",
"weight_hit",
"weight_travel",
"weight_think",
"weight_words",
]
for n_item in normals:

View File

@@ -43,6 +43,10 @@ class ArgSpec:
ArgSpec.infos = []
ArgSpec.add_arguments()
@staticmethod
def weight_info(what: str) -> str:
return f"The weight of the '{what}' method. The greater this value, the higher its chances of being selected"
@staticmethod
def add_argument(key: str, info: str, **kwargs: Any) -> None:
if key in ArgSpec.arguments:
@@ -184,3 +188,39 @@ class ArgSpec:
action="store_false",
info="Don't apply a fade-in effect on new updates",
)
ArgSpec.add_argument(
"weight_merge",
type=int,
info=ArgSpec.weight_info("merge"),
)
ArgSpec.add_argument(
"weight_triumph",
type=int,
info=ArgSpec.weight_info("triumph"),
)
ArgSpec.add_argument(
"weight_hit",
type=int,
info=ArgSpec.weight_info("hit"),
)
ArgSpec.add_argument(
"weight_travel",
type=int,
info=ArgSpec.weight_info("travel"),
)
ArgSpec.add_argument(
"weight_think",
type=int,
info=ArgSpec.weight_info("think"),
)
ArgSpec.add_argument(
"weight_words",
type=int,
info=ArgSpec.weight_info("words"),
)

View File

@@ -52,12 +52,23 @@ class Opt:
class Opts:
merge = Opt(1, Method.merge)
triumph = Opt(2, Method.triumph)
hit = Opt(2, Method.hit)
travel = Opt(2, Method.travel)
think = Opt(2, Method.think)
words = Opt(4, Method.words)
merge: Opt
triumph: Opt
hit: Opt
travel: Opt
think: Opt
words: Opt
@staticmethod
def prepare() -> None:
from .args import Args
Opts.merge = Opt(Args.weight_merge, Method.merge)
Opts.triumph = Opt(Args.weight_triumph, Method.triumph)
Opts.hit = Opt(Args.weight_hit, Method.hit)
Opts.travel = Opt(Args.weight_travel, Method.travel)
Opts.think = Opt(Args.weight_think, Method.think)
Opts.words = Opt(Args.weight_words, Method.words)
@staticmethod
def opts_score() -> list[Opt]:
@@ -86,6 +97,7 @@ class Game:
@staticmethod
def prepare() -> None:
Opts.prepare()
Game.timer = QTimer()
Game.timer.timeout.connect(Game.get_status)
@@ -448,6 +460,7 @@ class Game:
Game.started = False
Game.timer.stop()
Game.merge_charge = 0
Window.clear_view()
Ants.populate(size)
Window.to_top()

View File

@@ -1,5 +1,5 @@
{
"version": "4.4.0",
"version": "6.0.0",
"title": "Cromulant",
"program": "cromulant",
"author": "madprops",