Method weight args

This commit is contained in:
Auric Vente 2024-08-16 15:22:03 -06:00
parent 276da493f4
commit 9e2212293d
4 changed files with 68 additions and 7 deletions

View File

@ -29,6 +29,12 @@ class Args:
score: bool = False score: bool = False
mono: bool = False mono: bool = False
fade: bool = True 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 @staticmethod
def prepare() -> None: def prepare() -> None:
@ -62,6 +68,12 @@ class Args:
"argdoc", "argdoc",
"score", "score",
"mono", "mono",
"weight_merge",
"weight_triumph",
"weight_hit",
"weight_travel",
"weight_think",
"weight_words",
] ]
for n_item in normals: for n_item in normals:

View File

@ -34,6 +34,7 @@ class ArgSpec:
defaults: dict[str, Any] defaults: dict[str, Any]
arguments: dict[str, Any] arguments: dict[str, Any]
infos: list[str] infos: list[str]
weight_info = ", proportional to the other methods. The higher this is, the more likely it is to be picked"
@staticmethod @staticmethod
def prepare() -> None: def prepare() -> None:
@ -184,3 +185,39 @@ class ArgSpec:
action="store_false", action="store_false",
info="Don't apply a fade-in effect on new updates", info="Don't apply a fade-in effect on new updates",
) )
ArgSpec.add_argument(
"weight_merge",
type=int,
info=f"The weight of the merge method{ArgSpec.weight_info}",
)
ArgSpec.add_argument(
"weight_triumph",
type=int,
info=f"The weight of the triumph method{ArgSpec.weight_info}",
)
ArgSpec.add_argument(
"weight_hit",
type=int,
info=f"The weight of the hit method{ArgSpec.weight_info}",
)
ArgSpec.add_argument(
"weight_travel",
type=int,
info=f"The weight of the travel method{ArgSpec.weight_info}",
)
ArgSpec.add_argument(
"weight_think",
type=int,
info=f"The weight of the think method{ArgSpec.weight_info}",
)
ArgSpec.add_argument(
"weight_words",
type=int,
info=f"The weight of the words method{ArgSpec.weight_info}",
)

View File

@ -52,12 +52,23 @@ class Opt:
class Opts: class Opts:
merge = Opt(1, Method.merge) merge: Opt
triumph = Opt(2, Method.triumph) triumph: Opt
hit = Opt(2, Method.hit) hit: Opt
travel = Opt(2, Method.travel) travel: Opt
think = Opt(2, Method.think) think: Opt
words = Opt(4, Method.words) 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 @staticmethod
def opts_score() -> list[Opt]: def opts_score() -> list[Opt]:
@ -86,6 +97,7 @@ class Game:
@staticmethod @staticmethod
def prepare() -> None: def prepare() -> None:
Opts.prepare()
Game.timer = QTimer() Game.timer = QTimer()
Game.timer.timeout.connect(Game.get_status) Game.timer.timeout.connect(Game.get_status)

View File

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