sgf save
This commit is contained in:
1 parent
27236ab140
commit
76c38e8368
3 files changed
+8
-5
No files matched your search
@@ -240,6 +240,7 @@ TOP_MOVE_OPTIONS = [
|
||||
TOP_MOVE_VISITS,
|
||||
TOP_MOVE_NOTHING,
|
||||
]
|
||||
REPORT_DT = 0.25
|
||||
|
||||
SGF_INTERNAL_COMMENTS_MARKER = "\u3164\u200b"
|
||||
SGF_SEPARATOR_MARKER = "\u3164\u3164"
|
||||
@@ -62,8 +62,9 @@ class Game:
|
||||
self.insert_after = None
|
||||
|
||||
self.region_of_interest = None
|
||||
|
||||
self.external_game = False # not generated by katrain at some point
|
||||
if move_tree:
|
||||
self.external_game = PROGRAM_NAME not in self.root.get_property("AP", "")
|
||||
self.root = move_tree
|
||||
self.komi = self.root.komi
|
||||
handicap = int(self.root.get_property("HA", 0))
|
||||
@@ -405,8 +406,8 @@ class Game:
|
||||
|
||||
root_properties = self.root.properties
|
||||
x_properties = {}
|
||||
if PROGRAM_NAME in self.root.get_property("AP", ""):
|
||||
for bw in "BW":
|
||||
for bw in "BW":
|
||||
if not self.external_game:
|
||||
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:
|
||||
@@ -533,7 +534,7 @@ class Game:
|
||||
for move in analyze_moves:
|
||||
if cn.analysis["moves"].get(move.gtp(), {"visits": 0})["visits"] < visits:
|
||||
cn.analyze(
|
||||
engine, priority=priority, visits=visits, refine_move=move, time_limit=False, report_every=None
|
||||
engine, priority=priority, visits=visits, refine_move=move, time_limit=False
|
||||
) # explicitly requested so take as long as you need
|
||||
|
||||
def play_to_end(self):
|
||||
|
||||
@@ -11,6 +11,7 @@ from katrain.core.constants import (
|
||||
SGF_INTERNAL_COMMENTS_MARKER,
|
||||
SGF_SEPARATOR_MARKER,
|
||||
VERSION,
|
||||
REPORT_DT,
|
||||
)
|
||||
from katrain.core.lang import i18n
|
||||
from katrain.core.sgf_parser import Move, SGFNode
|
||||
@@ -173,7 +174,7 @@ class GameNode(SGFNode):
|
||||
analyze_fast=False,
|
||||
find_alternatives=False,
|
||||
region_of_interest=None,
|
||||
report_every=0.25,
|
||||
report_every=REPORT_DT,
|
||||
):
|
||||
additional_moves = bool(find_alternatives or region_of_interest)
|
||||
engine.request_analysis(
|
||||
|
||||
Reference in new issue
Block a user