This commit is contained in:
Sander Land committed 2020-05-20 17:47:32 +02:00
1 parent a136ff6407
commit a31eda4925
3 files changed
+33 -31

No files matched your search

+5 -4
View File
@@ -291,10 +291,9 @@ class KaTrainGui(BoxLayout):
"r": self.analysis_controls.ownership,
"t": self.analysis_controls.policy,
"enter": ("ai-move",),
"a": self.controls.analyze_extra,
"s": self.controls.analyze_equalize,
"d": self.controls.analyze_sweep,
"spacebar": self.controls.pause,
"a": self.analysis_controls.analyze_extra,
"s": self.analysis_controls.analyze_equalize,
"d": self.analysis_controls.analyze_sweep,
"p": ("play", None),
"right": ("switch-branch", 1),
"left": ("switch-branch", -1),
@@ -307,6 +306,8 @@ class KaTrainGui(BoxLayout):
self(*shortcut)
elif keycode[1] == "tab":
self.controls.switch_mode()
elif keycode[1]== "spacebar":
self.controls.timer.paused = not self.controls.timer.paused
elif keycode[1] in ["`", "~", "m"]:
self.controls_box.hidden = not self.controls_box.hidden
elif keycode[1] in ["up", "z"]:
+25 -24
View File
@@ -352,6 +352,9 @@
policy: policy
hints: hints
ownership: ownership
analyze_extra: analyze_extra
analyze_equalize: analyze_equalize
analyze_sweep: analyze_sweep
Label:
text: '='
size_hint_x: None
@@ -457,7 +460,7 @@
size_hint: 1, None
icon_margin: 0.2 * self.size[0]
icon: 'img/flaticon/pause.png'
state: 'down' if root.paused else 'up'
state: 'down' if root.paused else 'normal'
on_press: root.paused = not root.paused
Label:
@@ -512,7 +515,9 @@
<StatsBox@BoxLayout>
orientation: 'vertical'
score: score
win_rate: win_rate
score_change: score_change
CensorableLabel:
id: win_rate
label: 'Win rate'
@@ -522,8 +527,8 @@
label: 'Score Estimate'
text: ''
CensorableLabel:
id: point_loss
label: 'Score Estimate'
id: score_change
label: 'Points Lost'
text: ''
@@ -559,12 +564,13 @@
#:set PLAYER_BOX_HEIGHT 0.15
#:set TIMER_BOX_HEIGHT 0.3
#:set GRAPH_BOX_HEIGHT 0.33
#:set STATS_BOX_HEIGHT 0.27
#:set GRAPH_BOX_HEIGHT 0.35
#:set STATS_BOX_HEIGHT 0.25
#:set INFO_BOX_HEIGHT 1
#:set CP_SPACING 2
#:set CP_PADDING 2
#:set CP_SPACING 6
#:set CP_SMALL_SPACING 3
#:set CP_PADDING 4
<ControlsPanel>:
katrain: app.gui
@@ -623,22 +629,20 @@
height: min( (len(self._lines)+0.7) * self.line_height, self.parent.height - status.height - 2.7*self.line_height)
<RHSButton@MDRectangleFlatButton>:
height: self.width * 0.3
width: self.parent.width
canvas.before:
Color:
rgb: (1,0,0,1)
Rectangle:
pos: self.pos
size: (self.size[0]-2,self.size[1]-5)
height: self.parent.parent.height / 25
width: self.height * 3.5
on_press: print(self.height, self.width, self.height * 3.5, self.parent.parent.height)
<ButtonBox@BoxLayout>
<ButtonBox@MDBoxLayout>
orientation: 'vertical'
spacing: CP_SPACING
adaptive_width: True
width: self.minimum_width
spacing: CP_SMALL_SPACING
<RightButtonControls@BoxLayout>:
<RightButtonControls@MDBoxLayout>:
orientation: 'vertical'
adaptive_width: True
width: self.minimum_width
padding: CP_PADDING,CP_PADDING
spacing: CP_SPACING
ButtonBox:
@@ -871,10 +875,7 @@
opacity: 0 if root.zen else 1
RightButtonControls:
id: button_controls
size_hint_x: None
hidden: False
width: 0 if root.zen else controls.width * 0.3
opacity: 0 if root.zen else 1
<LoadSGFPopup>:
fast: fast
+3 -3
View File
@@ -8,7 +8,7 @@ from kivy.graphics.vertex_instructions import Ellipse, Line, Rectangle
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.widget import Widget
from katrain.core.common import OUTPUT_DEBUG, evaluation_class
from katrain.core.common import OUTPUT_DEBUG, evaluation_class, PLAYER_AI
from katrain.core.game import Move
from katrain.gui.kivyutils import draw_circle, draw_text
from katrain.core.common import var_to_grid
@@ -209,7 +209,7 @@ class BadukPanWidget(Widget):
for m in katrain.game.stones:
has_stone[m.coords] = m.player
show_dots_for = {p: self.trainer_config["eval_show_ai"] or "ai" not in katrain.controls.player_mode(p) for p in Move.PLAYERS}
show_dots_for = {p: self.trainer_config["eval_show_ai"] or katrain.controls.player_mode(p)!=PLAYER_AI for p in Move.PLAYERS}
nodes = katrain.game.current_node.nodes_from_root
realized_points_lost = None
for i, node in enumerate(nodes[::-1]): # reverse order!
@@ -254,7 +254,7 @@ class BadukPanWidget(Widget):
Rectangle(pos=(self.gridpos_x[x] - rsz / 2, self.gridpos_y[y] - rsz / 2), size=(rsz, rsz))
policy = current_node.policy
if not policy and current_node.parent and current_node.parent.policy and "ai" in katrain.controls.player_mode("B") and "ai" in katrain.controls.player_mode("W"):
if not policy and current_node.parent and current_node.parent.policy and katrain.controls.player_mode("B")==PLAYER_AI and katrain.controls.player_mode("W")==PLAYER_AI:
policy = current_node.parent.policy # in the case of AI self-play we allow the policy to be one step out of date
pass_btn = katrain.board_controls.pass_btn