player name save/load,komi

This commit is contained in:
Sander Land committed 2020-12-06 23:06:55 +01:00
1 parent fbefcdbb7f
commit b3ee899ec4
4 files changed
+8 -9

No files matched your search

+3 -3
View File
@@ -20,7 +20,7 @@ from katrain.core.constants import (
STATUS_ERROR,
STATUS_INFO,
STATUS_TEACHING,
VERSION,
VERSION, SGF_INTERNAL_COMMENTS_MARKER,
)
from katrain.core.engine import KataGoEngine
from katrain.core.game_node import GameNode
@@ -399,7 +399,7 @@ class Game:
x_properties = {}
if PROGRAM_NAME in self.root.get_property("AP", ""):
for bw in "BW":
x_properties["P" + bw] = player_name(self.katrain.players_info[bw])
x_properties["P" + bw] = player_name(self.katrain.players_info[bw]) + SGF_INTERNAL_COMMENTS_MARKER
player_info = self.katrain.players_info[bw]
if player_info.player_type == PLAYER_AI:
x_properties[bw + "R"] = rank_label(player_info.calculated_rank)
@@ -407,7 +407,7 @@ class Game:
x_properties["RE"] = self.end_result
x_properties["KTV"] = ANALYSIS_FORMAT_VERSION
self.root.properties = {**root_properties, **{k: [v] for k, v in x_properties.items()}}
player_names = {bw: re.sub(r"['<>:\"/\\|?*]", "", self.root.get_property("P" + bw, bw)) for bw in "BW"}
player_names = {bw: re.sub(r"[\u200b\u3164'<>:\"/\\|?*]", "", self.root.get_property("P" + bw, bw)) for bw in "BW"}
base_game_name = f"{PROGRAM_NAME}_{player_names['B']} vs {player_names['W']}"
return f"{base_game_name} {self.game_id}.sgf"
+1 -1
View File
@@ -136,7 +136,7 @@ class GameNode(SGFNode):
comments = [
i18n._("SGF start message") + SGF_INTERNAL_COMMENTS_MARKER + "\n",
*comments,
f"\nSGF with generated by {PROGRAM_NAME} {VERSION}{SGF_INTERNAL_COMMENTS_MARKER}.\n",
f"\nSGF generated by {PROGRAM_NAME} {VERSION}{SGF_INTERNAL_COMMENTS_MARKER}\n",
]
if self.shortcut_from:
properties["KTSF"] = [id(self.shortcut_from)]