next mistake
This commit is contained in:
1 parent
6d6678a348
commit
0d03bb1831
6 files changed
+24
-12
No files matched your search
+5
-2
@@ -159,7 +159,6 @@ class KaTrainGui(Screen, KaTrainBase):
|
||||
self.board_controls.mid_circles_container.clear_widgets()
|
||||
self.board_controls.mid_circles_container.add_widget(bot)
|
||||
self.board_controls.mid_circles_container.add_widget(top)
|
||||
self.board_controls.branch.disabled = not cn.parent or len(cn.parent.children) <= 1
|
||||
self.controls.players["W"].captures = prisoners["W"]
|
||||
self.controls.players["B"].captures = prisoners["B"]
|
||||
|
||||
@@ -295,6 +294,10 @@ class KaTrainGui(Screen, KaTrainBase):
|
||||
self.board_gui.animating_pv = None
|
||||
self.game.redo(n_times)
|
||||
|
||||
def _do_next_mistake(self):
|
||||
self.board_gui.animating_pv = None
|
||||
self.game.redo(999, stop_on_mistake=self.config("trainer/eval_thresholds")[-4])
|
||||
|
||||
def _do_cycle_children(self, *args):
|
||||
self.board_gui.animating_pv = None
|
||||
self.game.cycle_children(*args)
|
||||
@@ -358,7 +361,7 @@ class KaTrainGui(Screen, KaTrainBase):
|
||||
self.ai_settings_popup.content.popup = self.ai_settings_popup
|
||||
self.ai_settings_popup.open()
|
||||
|
||||
def load_sgf_file(self, file, fast=False, rewind=False):
|
||||
def load_sgf_file(self, file, fast=False, rewind=True):
|
||||
try:
|
||||
move_tree = KaTrainSGF.parse_file(file)
|
||||
except ParseError as e:
|
||||
|
||||
@@ -47,7 +47,7 @@ AI_STRATEGIES_RECOMMENDED_ORDER = [
|
||||
AI_RANK,
|
||||
AI_HANDICAP,
|
||||
AI_SIMPLE_OWNERSHIP,
|
||||
AI_SETTLE_STONES,
|
||||
# AI_SETTLE_STONES,
|
||||
AI_SCORELOSS,
|
||||
AI_POLICY,
|
||||
AI_WEIGHTED,
|
||||
|
||||
+13
-3
@@ -185,12 +185,22 @@ class Game:
|
||||
cn = cn.parent
|
||||
self.set_current_node(cn)
|
||||
|
||||
def redo(self, n_times=1):
|
||||
def redo(self, n_times=1, stop_on_mistake=None):
|
||||
cn = self.current_node # avoid race conditions
|
||||
for _ in range(n_times):
|
||||
for move in range(n_times):
|
||||
if cn.children:
|
||||
cn = cn.ordered_children[0]
|
||||
self.set_current_node(cn)
|
||||
if (
|
||||
move > 0
|
||||
and stop_on_mistake is not None
|
||||
and cn.points_lost is not None
|
||||
and cn.points_lost >= stop_on_mistake
|
||||
and self.katrain.players_info[cn.player].player_type != PLAYER_AI
|
||||
):
|
||||
self.set_current_node(cn.parent)
|
||||
return
|
||||
if stop_on_mistake is None:
|
||||
self.set_current_node(cn)
|
||||
|
||||
def cycle_children(self, direction):
|
||||
cn = self.current_node # avoid race conditions
|
||||
|
||||
+4
-6
@@ -126,7 +126,7 @@
|
||||
pos: [root.pos[i] + (root.size[i] - root.icon_size[i])/2 for i in [0,1]]
|
||||
source: root.icon
|
||||
mipmap: True
|
||||
color: [1,1,1,0.4] if root.disabled else [1,1,1,1]
|
||||
color: [1,1,1,0.4] if root.disabled else root.color
|
||||
|
||||
|
||||
<I18NSpinnerOption@SpinnerOption>:
|
||||
@@ -185,7 +185,6 @@
|
||||
|
||||
<BadukPanControls>:
|
||||
katrain: app.gui
|
||||
branch: branch
|
||||
circles: [black_circle,white_circle]
|
||||
mid_circles_container: mid_circles_container
|
||||
pass_btn: pass_btn
|
||||
@@ -236,10 +235,9 @@
|
||||
icon: 'img/Next-End.png'
|
||||
on_press: root.katrain('redo',999)
|
||||
NavIconButton:
|
||||
id: branch
|
||||
icon: 'img/Branch.png'
|
||||
on_press: root.katrain('cycle-children',1)
|
||||
disabled: True
|
||||
icon: 'img/Next-Mistake.png'
|
||||
color: [0.65,0.05,0.05,1]
|
||||
on_press: root.katrain('next-mistake')
|
||||
ClickableLabel:
|
||||
pos_hint: {'center_x': 0.85,'center_y':0.5}
|
||||
size_hint: None, 1
|
||||
|
||||
@@ -112,6 +112,7 @@ class AutoSizedRectangleToggleButton(ToggleButtonMixin, AutoSizedRectangleButton
|
||||
|
||||
|
||||
class TransparentIconButton(CircularRippleBehavior, Button):
|
||||
color = ListProperty([1, 1, 1, 1])
|
||||
icon_size = ListProperty([25, 25])
|
||||
icon = StringProperty("")
|
||||
disabled = BooleanProperty(False)
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
Reference in new issue
Block a user