diff --git a/CONTRIBUTIONS.md b/CONTRIBUTIONS.md index aff3295..0a4492b 100644 --- a/CONTRIBUTIONS.md +++ b/CONTRIBUTIONS.md @@ -46,7 +46,7 @@ Many thanks to these additional authors: * "bale-go" for development and continued work on the 'calibrated rank' AI and rank estimation algorithm. * "Dontbtme" for detailed feedback and early testing of v1.0+. * "nowoowoo" for a fix to the parser for SGF files with extra line breaks. -* "nimets123" for the timer sound effects. +* "nimets123" for the timer sound effects and stone graphics. * Jordan Seaward for the stone sound effects. * "fohristiwhirl" for the Gibo format parsing code. diff --git a/katrain/core/game.py b/katrain/core/game.py index 3f715ca..9f8b8cf 100644 --- a/katrain/core/game.py +++ b/katrain/core/game.py @@ -161,8 +161,9 @@ class Game: except IllegalMoveException: self._calculate_groups() raise - played_node = self.current_node.play(move) - self.current_node = played_node + with self._lock: + played_node = self.current_node.play(move) + self.current_node = played_node if analyze: played_node.analyze(self.engines[played_node.next_player]) return played_node diff --git a/katrain/core/game_node.py b/katrain/core/game_node.py index 74decf9..4a51d23 100644 --- a/katrain/core/game_node.py +++ b/katrain/core/game_node.py @@ -230,7 +230,7 @@ class GameNode(SGFNode): polmoves = self.policy_ranking top_polmove = polmoves[0][1] if polmoves else Move(None) # if no info at all, pass return [ - {**self.analysis["root"], "pointsLost": 0, "order": 0, "move": top_polmove.gtp()} + {**self.analysis["root"], "pointsLost": 0, "order": 0, "move": top_polmove.gtp(),"pv":[top_polmove.gtp()]} ] # single visit -> go by policy/root root_score = self.analysis["root"]["scoreLead"] diff --git a/katrain/gui/badukpan.py b/katrain/gui/badukpan.py index 2241314..4c36c71 100644 --- a/katrain/gui/badukpan.py +++ b/katrain/gui/badukpan.py @@ -153,11 +153,11 @@ class BadukPanWidget(Widget): source=f"img/dot.png") if innercol: Color(*innercol) - inner_size = stone_size * 0.75 + inner_size = stone_size * 0.8 Rectangle( pos=(self.gridpos_x[x] - inner_size, self.gridpos_y[y] - inner_size), size=(2 * inner_size, 2 * inner_size), - source=f"img/last_move_ring.png", + source=f"img/inner.png", ) def eval_color(self, points_lost, show_dots_for_class: List[bool] = None) -> Optional[List[float]]: @@ -376,7 +376,6 @@ class BadukPanWidget(Widget): game_ended = katrain.game.ended current_node = katrain.game.current_node player, next_player = current_node.player, current_node.next_player - stone_color = STONE_COLORS with self.canvas.after: self.canvas.after.clear() @@ -448,14 +447,13 @@ class BadukPanWidget(Widget): def draw_pv(self, pv, node, up_to_move): katrain = self.katrain next_last_player = [node.next_player, node.player] - stone_color = STONE_COLORS cn = katrain.game.current_node if node != cn and node.parent != cn: hide_node = cn while hide_node and hide_node.move and hide_node != node: if not hide_node.move.is_pass: - if False: # TODO - self.draw_stone(*hide_node.move.coords, [0.85, 0.68, 0.40, 0.8]) # board coloured dot + pos = (self.gridpos_x[hide_node.move.coords[0]],self.gridpos_y[hide_node.move.coords[1]]) + draw_circle(pos, self.stone_size, [0.85, 0.68, 0.40, 0.8]) hide_node = hide_node.parent for i, gtpmove in enumerate(pv): if i > up_to_move: @@ -474,7 +472,13 @@ class BadukPanWidget(Widget): board_coords = (self.gridpos_x[coords[0]], self.gridpos_y[coords[1]]) sizefac = 1 - draw_circle(board_coords, self.stone_size * sizefac, stone_color[move_player]) + stone_size = self.stone_size * sizefac + Color(1,1,1,1) + Rectangle( + pos=(board_coords[0]-stone_size,board_coords[1]-stone_size), + size=(2 * stone_size, 2 * stone_size), + source=f"img/{move_player}_stone.png", + ) Color(*STONE_TEXT_COLORS[move_player]) draw_text(pos=board_coords, text=str(i + 1), font_size=self.grid_size * sizefac / 1.45, font_name="Roboto") diff --git a/katrain/gui/style.py b/katrain/gui/style.py index 5a1920c..4141077 100644 --- a/katrain/gui/style.py +++ b/katrain/gui/style.py @@ -46,7 +46,7 @@ LINE_COLOR = [0, 0, 0] POLICY_COLOR = [0.9, 0.2, 0.8] STARPOINT_SIZE = 0.1 BOARD_COLOR = [0.85, 0.68, 0.40, 1] -STONE_SIZE = 0.5 +STONE_SIZE = 0.505 # texture edge is transparent VISITS_FRAC_SMALL = 0.1 GHOST_ALPHA = 0.5 diff --git a/katrain/img/inner.png b/katrain/img/inner.png new file mode 100644 index 0000000..0e1319e Binary files /dev/null and b/katrain/img/inner.png differ