fixes
This commit is contained in:
1 parent
54e61b9b03
commit
153eed29b0
6 files changed
+13
-7
No files matched your search
@@ -51,6 +51,8 @@ class KataGoEngine:
|
||||
def _analysis_read_thread(self):
|
||||
while True:
|
||||
line = self.katago_process.stdout.readline()
|
||||
if b"Uncaught exception" in line:
|
||||
self.katrain.log(f"KataGo Engine Failed: {line.decode()}",OUTPUT_ERROR)
|
||||
if not line:
|
||||
continue
|
||||
analysis = json.loads(line)
|
||||
@@ -69,6 +71,7 @@ class KataGoEngine:
|
||||
def request_analysis(
|
||||
self, analysis_node: GameNode, callback: Callable, faster=False, min_visits=0, priority=0, ownership=None
|
||||
):
|
||||
self.fast = self.katrain.controls.ai_fast.active
|
||||
query_id = f"QUERY:{str(self.query_counter)}"
|
||||
self.query_counter += 1
|
||||
visits = 100 # TODO / fast = self.ai_fast.active
|
||||
|
||||
@@ -39,7 +39,8 @@ class Game:
|
||||
else:
|
||||
self.board_size = board_size or config['size']
|
||||
self.komi = self.config.get(f"komi_{self.board_size}",6.5)
|
||||
self.root = GameNode(properties={"GM":1,"FF":4,"RU": "JP", "SZ": self.board_size, "KM": self.komi, "AP": "[KaTrain:https://github.com/sanderland/katrain]", "DT": self.game_id})
|
||||
self.root = GameNode(properties={"GM":1,"FF":4,"RU": "JP", "SZ": self.board_size, "KM": self.komi,
|
||||
"AP": "KaTrain:https://github.com/sanderland/katrain", "DT": self.game_id})
|
||||
|
||||
self.current_node = self.root
|
||||
self._init_chains()
|
||||
|
||||
+2
-2
@@ -177,7 +177,7 @@ class BadukPanWidget(Widget):
|
||||
for child_node in current_node.children:
|
||||
points_lost = child_node.points_lost
|
||||
m = child_node.single_move
|
||||
if m and m.coords[0] is not None:
|
||||
if m and m.coords is not None:
|
||||
undo_coords.add(m.coords)
|
||||
evalcol = (*self.eval_color(points_lost), alpha) if points_lost is not None else None
|
||||
scale = self.config.get("undo_scale", 0.95)
|
||||
@@ -189,7 +189,7 @@ class BadukPanWidget(Widget):
|
||||
for i, d in enumerate(hint_moves):
|
||||
move = Move.from_gtp(d["move"])
|
||||
c = [*self.eval_color(d["pointsLost"]), 0.5]
|
||||
if move.coords[0] is not None and move.coords not in undo_coords:
|
||||
if move.coords is not None and move.coords not in undo_coords:
|
||||
if i == 0:
|
||||
scale = 1.0
|
||||
elif d["visits"] < 0.1 * hint_moves[0]["visits"]: # TODO: config?
|
||||
|
||||
+3
-3
@@ -338,17 +338,17 @@
|
||||
size_hint: 0.233, 1
|
||||
text: '9'
|
||||
margin: (1,1)
|
||||
on_press: root.restart(9)
|
||||
on_press: root.parent('new-game',9)
|
||||
StyledButton:
|
||||
size_hint: 0.233, 1
|
||||
text: '13'
|
||||
margin: (0,1)
|
||||
on_press: root.restart(13)
|
||||
on_press: root.parent('new-game',13)
|
||||
StyledButton:
|
||||
size_hint: 0.233, 1
|
||||
text: '19'
|
||||
margin: (1,1)
|
||||
on_press: root.restart(19)
|
||||
on_press: root.parent('new-game',19)
|
||||
|
||||
<KaTrainGui>:
|
||||
board_gui: board_gui
|
||||
|
||||
+1
-1
@@ -157,7 +157,7 @@ class KaTrainGui(BoxLayout):
|
||||
|
||||
def redraw(self, include_board=False): # TODO: rename? does more now
|
||||
cn = self.game.current_node
|
||||
if cn.analysis_ready and self.controls.ai_auto.active(cn.next_player) and not cn.children:
|
||||
if cn.analysis_ready and self.controls.ai_auto.active(cn.next_player) and not cn.children and not self.game.game_ended:
|
||||
self._do_aimove()
|
||||
|
||||
if include_board:
|
||||
|
||||
@@ -77,6 +77,8 @@ class SGFNode:
|
||||
return copy.deepcopy(self.properties)
|
||||
|
||||
def sgf(self) -> str:
|
||||
import sys # TODO
|
||||
sys.setrecursionlimit(max(sys.getrecursionlimit(),3*29*29))
|
||||
sgf_str = "".join([prop + "".join(f"[{v}]" for v in values) for prop, values in self.sgf_properties.items() if values])
|
||||
if self.children:
|
||||
children = [c.sgf() for c in self.children]
|
||||
|
||||
Reference in new issue
Block a user