config top move
This commit is contained in:
1 parent
41142e2179
commit
f1350721a2
8 files changed
+119
-25
No files matched your search
@@ -1,6 +1,6 @@
|
||||
VERSION = "1.6.0"
|
||||
VERSION = "1.7.0"
|
||||
HOMEPAGE = "https://github.com/sanderland/katrain"
|
||||
CONFIG_MIN_VERSION = "1.6.0" # keep config files from this version
|
||||
CONFIG_MIN_VERSION = "1.7.0" # keep config files from this version
|
||||
|
||||
OUTPUT_ERROR = -1
|
||||
OUTPUT_KATAGO_STDERR = -0.5
|
||||
@@ -220,3 +220,13 @@ AI_PICK_ELO_GRID = [
|
||||
[514.0, 670.0, 870.0, 1128.0, 1305.0, 1550.0, 1700.0, 1700.0],
|
||||
],
|
||||
]
|
||||
|
||||
|
||||
TOP_MOVE_DELTA_SCORE = "delta score"
|
||||
TOP_MOVE_SCORE = "score"
|
||||
TOP_MOVE_DELTA_WINRATE = "delta winrate"
|
||||
TOP_MOVE_WINRATE = "winrate"
|
||||
TOP_MOVE_VISITS = "visits"
|
||||
TOP_MOVE_NOTHING = "<nothing>"
|
||||
|
||||
TOP_MOVE_OPTIONS = [TOP_MOVE_DELTA_SCORE, TOP_MOVE_SCORE, TOP_MOVE_DELTA_WINRATE, TOP_MOVE_WINRATE, TOP_MOVE_VISITS, TOP_MOVE_NOTHING]
|
||||
@@ -276,6 +276,7 @@ class GameNode(SGFNode):
|
||||
{
|
||||
**self.analysis["root"],
|
||||
"pointsLost": 0,
|
||||
"winrateLost": 0,
|
||||
"order": 0,
|
||||
"move": top_polmove.gtp(),
|
||||
"pv": [top_polmove.gtp()],
|
||||
@@ -283,10 +284,15 @@ class GameNode(SGFNode):
|
||||
] # single visit -> go by policy/root
|
||||
|
||||
root_score = self.analysis["root"]["scoreLead"]
|
||||
root_winrate = self.analysis["root"]["winrate"]
|
||||
move_dicts = list(self.analysis["moves"].values()) # prevent incoming analysis from causing crash
|
||||
return sorted(
|
||||
[
|
||||
{"pointsLost": self.player_sign(self.next_player) * (root_score - d["scoreLead"]), **d}
|
||||
{
|
||||
"pointsLost": self.player_sign(self.next_player) * (root_score - d["scoreLead"]),
|
||||
"winrateLost": self.player_sign(self.next_player) * (root_winrate - d["winrate"]),
|
||||
**d,
|
||||
}
|
||||
for d in move_dicts
|
||||
],
|
||||
key=lambda d: (d["order"], d["pointsLost"]),
|
||||
|
||||
@@ -53,3 +53,14 @@ def find_package_resource(path, silent_errors=False):
|
||||
return os.path.join(PATHS["PACKAGE"], path.replace("katrain\\", "katrain/").replace("katrain/", ""))
|
||||
else:
|
||||
return os.path.abspath(os.path.expanduser(path)) # absolute path
|
||||
|
||||
|
||||
def format_visits(n):
|
||||
if n < 1000:
|
||||
return str(n)
|
||||
if n < 1e6:
|
||||
return f"{n/1000:.1f}k"
|
||||
if n < 1e6:
|
||||
return f"{n/1000:.0f}k"
|
||||
return f"{n/1e6:.0f}k"
|
||||
|
||||
Reference in new issue
Block a user