update parent move, readme, analysis tab select
This commit is contained in:
1 parent
dfda7d4d30
commit
460494c72c
7 files changed
+27
-12
No files matched your search
+3
-2
@@ -33,8 +33,9 @@
|
||||
Kivy currently does not have a release for Python 3.8.
|
||||
* Open a terminal.
|
||||
* Run the command `git clone https://github.com/sanderland/katrain.git` to download the repository.
|
||||
* Changing directory using `cd katrain`.
|
||||
* Run the command `python3 setup.py install`.
|
||||
* Changing directory using `cd katrain`
|
||||
* Run the command `python3 setup.py install`
|
||||
* If you get an error about permissions, try `python3 setup.py install --user`
|
||||
* A binary for KataGo is included, but if you have compiled your own, point the 'engine/katago' setting to the relevant KataGo v1.4+ binary.
|
||||
* Run the program by typing `katrain` in the terminal.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# KaTrain v1.0.5
|
||||
# KaTrain v1.0.6
|
||||
|
||||
KaTrain is a tool for analyzing and playing go with AI feedback from KataGo.
|
||||
|
||||
|
||||
+12
-5
@@ -106,11 +106,18 @@ class KaTrainGui(BoxLayout):
|
||||
def update_state(self, redraw_board=False): # is called after every message and on receiving analyses and config changes
|
||||
# AI and Trainer/auto-undo handlers
|
||||
cn = self.game.current_node
|
||||
auto_undo = cn.player and "undo" in self.controls.player_mode(cn.player)
|
||||
if auto_undo and cn.analysis_ready and cn.parent and cn.parent.analysis_ready and not cn.children and not self.game.ended:
|
||||
self.game.analyze_undo(cn, self.config("trainer")) # not via message loop
|
||||
if cn.analysis_ready and "ai" in self.controls.player_mode(cn.next_player).lower() and not cn.children and not self.game.ended and not (auto_undo and cn.auto_undo is None):
|
||||
self._do_ai_move(cn) # cn mismatch stops this if undo fired. avoid message loop here or fires repeatedly.
|
||||
if self.controls.play_analyze_mode == "play":
|
||||
auto_undo = cn.player and "undo" in self.controls.player_mode(cn.player)
|
||||
if auto_undo and cn.analysis_ready and cn.parent and cn.parent.analysis_ready and not cn.children and not self.game.ended:
|
||||
self.game.analyze_undo(cn, self.config("trainer")) # not via message loop
|
||||
if (
|
||||
cn.analysis_ready
|
||||
and "ai" in self.controls.player_mode(cn.next_player).lower()
|
||||
and not cn.children
|
||||
and not self.game.ended
|
||||
and not (auto_undo and cn.auto_undo is None)
|
||||
):
|
||||
self._do_ai_move(cn) # cn mismatch stops this if undo fired. avoid message loop here or fires repeatedly.
|
||||
|
||||
# Handle prisoners and next player display
|
||||
prisoners = self.game.prisoner_count
|
||||
|
||||
@@ -82,6 +82,8 @@ class GameNode(SGFNode):
|
||||
self.ownership = analysis_json.get("ownership")
|
||||
self.policy = analysis_json.get("policy")
|
||||
self.analysis["root"] = analysis_json["rootInfo"]
|
||||
if self.parent and self.move:
|
||||
self.parent.update_move_analysis(analysis_json["rootInfo"], self.move.gtp()) # update analysis in parent for consistency
|
||||
|
||||
@property
|
||||
def analysis_ready(self):
|
||||
|
||||
@@ -311,7 +311,7 @@ class BadukPanWidget(Widget):
|
||||
else:
|
||||
evalcol = copy.copy(self.eval_color(points_lost))
|
||||
evalcol[3] = alpha
|
||||
if teaching and child_node.auto_undo and child_node.analysis_ready:
|
||||
if ((teaching and child_node.auto_undo) or katrain.controls.play_analyze_mode == "analyze") and child_node.analysis_ready:
|
||||
self.active_pv_moves.append((move.coords, child_node.candidate_moves[0]["pv"], child_node))
|
||||
scale = self.ui_config["child_scale"]
|
||||
self.draw_stone(move.coords[0], move.coords[1], (*stone_color[move.player][:3], alpha), None, None, evalcol, evalscale=scale, scale=scale)
|
||||
|
||||
@@ -25,8 +25,14 @@ class Controls(BoxLayout):
|
||||
else:
|
||||
self.play_tab_button.trigger_action(duration=0)
|
||||
|
||||
def switch_mode(self):
|
||||
@property
|
||||
def play_analyze_mode(self):
|
||||
if self.play_tab_button.state == "down":
|
||||
return "play"
|
||||
return "analyze"
|
||||
|
||||
def switch_mode(self):
|
||||
if self.play_analyze_mode == "play":
|
||||
self.select_mode("analyze")
|
||||
else:
|
||||
self.select_mode("play")
|
||||
|
||||
@@ -111,7 +111,7 @@ class StyledSpinner(Spinner):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.fbind("size", lambda s,dt: Clock.schedule_once(self._update_dropdown_size_frac,0) )
|
||||
self.fbind("size", lambda s, dt: Clock.schedule_once(self._update_dropdown_size_frac, 0))
|
||||
|
||||
def _update_dropdown_size_frac(self, *largs):
|
||||
if not self.sync_height_frac:
|
||||
@@ -129,7 +129,6 @@ class StyledSpinner(Spinner):
|
||||
item.font_size = fsz
|
||||
|
||||
|
||||
|
||||
class ToggleButtonContainer(GridLayout):
|
||||
__events__ = ("on_selection",)
|
||||
|
||||
|
||||
Reference in new issue
Block a user