insert mode

This commit is contained in:
Sander Land committed 2020-12-03 18:04:29 +01:00
1 parent f85399ad57
commit da42fc4e0f
33 files changed
+256 -172

No files matched your search

+11 -1
View File
@@ -1,7 +1,8 @@
import copy
import glob
import os import os
import re import re
import sys import sys
import copy
from collections import defaultdict from collections import defaultdict
import polib import polib
@@ -100,4 +101,13 @@ for lang in locales:
print("Fixed", pofile[lang], "and converted ->", mofile) print("Fixed", pofile[lang], "and converted ->", mofile)
for file in glob.glob("katrain/**/*.py") + glob.glob("katrain/**/*.kv"):
with open(file, "r") as f:
for i, line in enumerate(f.readlines()):
matches = [m.strip() for m in re.findall(r"i18n._\((.*?)\)", line)]
for msgid in matches:
if msgid[0] in ['"', "'"] and msgid.strip("\"'") not in strings_to_langs: # not code
print(f"Missing {msgid} used in code at \t{file}:{i} \t'{line.strip()}'")
errors += 1
sys.exit(int(errors)) sys.exit(int(errors))
+6
View File
@@ -273,6 +273,11 @@ class KaTrainGui(Screen, KaTrainBase):
# self.controls.rank_graph.initialize_from_game(self.game.root) # self.controls.rank_graph.initialize_from_game(self.game.root)
self.update_state(redraw_board=True) self.update_state(redraw_board=True)
def _do_insert_mode(self, mode="toggle"):
self.game.set_insert_mode(mode)
if self.play_analyze_mode != MODE_ANALYZE:
self.play_mode.switch_ui_mode()
def _do_ai_move(self, node=None): def _do_ai_move(self, node=None):
if node is None or self.game.current_node == node: if node is None or self.game.current_node == node:
mode = self.next_player_info.strategy mode = self.next_player_info.strategy
@@ -485,6 +490,7 @@ class KaTrainGui(Screen, KaTrainBase):
"d": ("analyze-extra", "sweep"), "d": ("analyze-extra", "sweep"),
"f": ("analyze-extra", "alternative"), "f": ("analyze-extra", "alternative"),
"g": ("analyze-extra", "local"), "g": ("analyze-extra", "local"),
"i": ("insert-mode",),
"p": ("play", None), "p": ("play", None),
"n": ("next-mistake",), "n": ("next-mistake",),
"down": ("switch-branch", 1), "down": ("switch-branch", 1),
-8
View File
@@ -98,14 +98,6 @@
"attach_penalty": 1, "attach_penalty": 1,
"tenuki_penalty": 0.5 "tenuki_penalty": 0.5
}, },
"ai:settle": {
"max_points_lost": 1.75,
"settled_weight": 1.0,
"opponent_fac": 0.5,
"min_visits": 3,
"attach_penalty": 1,
"tenuki_penalty": 0.5
},
"ai:p:weighted": { "ai:p:weighted": {
"weaken_fac": 1.25, "weaken_fac": 1.25,
"pick_override": 1.0, "pick_override": 1.0,
+1 -1
View File
@@ -18,6 +18,7 @@ from katrain.core.constants import (
AI_RANK, AI_RANK,
AI_SCORELOSS, AI_SCORELOSS,
AI_SCORELOSS_ELO, AI_SCORELOSS_ELO,
AI_SETTLE_STONES,
AI_SIMPLE_OWNERSHIP, AI_SIMPLE_OWNERSHIP,
AI_STRATEGIES_PICK, AI_STRATEGIES_PICK,
AI_STRATEGIES_POLICY, AI_STRATEGIES_POLICY,
@@ -32,7 +33,6 @@ from katrain.core.constants import (
OUTPUT_DEBUG, OUTPUT_DEBUG,
OUTPUT_ERROR, OUTPUT_ERROR,
OUTPUT_INFO, OUTPUT_INFO,
AI_SETTLE_STONES,
) )
from katrain.core.game import Game, GameNode, Move from katrain.core.game import Game, GameNode, Move
from katrain.core.utils import var_to_grid from katrain.core.utils import var_to_grid
+71 -3
View File
@@ -1,3 +1,4 @@
import copy
import math import math
import os import os
import re import re
@@ -8,17 +9,18 @@ from typing import Dict, List, Optional, Union
from kivy.clock import Clock from kivy.clock import Clock
from katrain.core.constants import ( from katrain.core.constants import (
ANALYSIS_FORMAT_VERSION,
HOMEPAGE, HOMEPAGE,
OUTPUT_DEBUG, OUTPUT_DEBUG,
OUTPUT_INFO, OUTPUT_INFO,
PLAYER_AI, PLAYER_AI,
PLAYER_HUMAN,
PROGRAM_NAME,
STATUS_ANALYSIS, STATUS_ANALYSIS,
STATUS_ERROR,
STATUS_INFO, STATUS_INFO,
STATUS_TEACHING, STATUS_TEACHING,
PLAYER_HUMAN,
VERSION, VERSION,
PROGRAM_NAME,
ANALYSIS_FORMAT_VERSION,
) )
from katrain.core.engine import KataGoEngine from katrain.core.engine import KataGoEngine
from katrain.core.game_node import GameNode from katrain.core.game_node import GameNode
@@ -57,6 +59,9 @@ class Game:
self.game_id = datetime.strftime(datetime.now(), "%Y-%m-%d %H %M %S") self.game_id = datetime.strftime(datetime.now(), "%Y-%m-%d %H %M %S")
self.sgf_filename = sgf_filename self.sgf_filename = sgf_filename
self.insert_mode = False
self.insert_after = None
if move_tree: if move_tree:
self.root = move_tree self.root = move_tree
self.komi = self.root.komi self.komi = self.root.komi
@@ -165,6 +170,55 @@ class Game:
if -1 not in neighbours(self.chains[this_chain]): # TODO: NZ rules? if -1 not in neighbours(self.chains[this_chain]): # TODO: NZ rules?
raise IllegalMoveException("Suicide") raise IllegalMoveException("Suicide")
def set_insert_mode(self, mode):
if mode == "toggle":
mode = not self.insert_mode
if mode == self.insert_mode:
return
self.insert_mode = mode
if mode:
children = self.current_node.ordered_children
if not children:
self.insert_mode = False
else:
self.insert_after = self.current_node.ordered_children[0]
self.katrain.controls.set_status(i18n._("starting insert mode"), STATUS_INFO)
else:
copy_from_node = self.insert_after
copy_to_node = self.current_node
num_copied = 0
if copy_to_node != self.insert_after.parent:
above_insertion_root = self.insert_after.parent.nodes_from_root
already_inserted_moves = [
n.move for n in copy_to_node.nodes_from_root if n not in above_insertion_root and n.move
]
print(already_inserted_moves)
try:
while True:
if copy_from_node.move not in already_inserted_moves:
for m in copy_from_node.move_with_placements:
self._validate_move_and_update_chains(m, True)
# this inserts
copy_to_node = GameNode(
parent=copy_to_node, properties=copy.deepcopy(copy_from_node.properties)
)
num_copied += 1
if not copy_from_node.children:
break
copy_from_node = copy_from_node.ordered_children[0]
except:
pass # illegal move = stop
self._calculate_groups() # recalculate groups
self.katrain.controls.set_status(
i18n._("ending insert mode").format(num_copied=num_copied), STATUS_INFO
)
self.analyze_all_nodes(analyze_fast=True, even_if_present=False)
else:
self.katrain.controls.set_status("", STATUS_INFO)
self.katrain.controls.move_tree.insert_node = self.insert_after if self.insert_mode else None
self.katrain.controls.move_tree.redraw()
self.katrain.update_state(redraw_board=True)
# Play a Move from the current position, raise IllegalMoveException if invalid. # Play a Move from the current position, raise IllegalMoveException if invalid.
def play(self, move: Move, ignore_ko: bool = False, analyze=True): def play(self, move: Move, ignore_ko: bool = False, analyze=True):
board_size_x, board_size_y = self.board_size board_size_x, board_size_y = self.board_size
@@ -183,17 +237,31 @@ class Game:
return played_node return played_node
def set_current_node(self, node): def set_current_node(self, node):
if self.insert_mode:
self.katrain.controls.set_status(i18n._("finish inserting before navigating"), STATUS_ERROR)
return
self.current_node = node self.current_node = node
self._calculate_groups() self._calculate_groups()
def undo(self, n_times=1): def undo(self, n_times=1):
# allow undo/delete only in insert mode
cn = self.current_node # avoid race conditions cn = self.current_node # avoid race conditions
if self.insert_mode:
if n_times == 1 and cn not in self.insert_after.nodes_from_root:
cn.parent.children = [c for c in cn.parent.children if c != cn]
self.current_node = cn.parent
self._calculate_groups()
return
for _ in range(n_times): for _ in range(n_times):
if not cn.is_root: if not cn.is_root:
cn = cn.parent cn = cn.parent
self.set_current_node(cn) self.set_current_node(cn)
def redo(self, n_times=1, stop_on_mistake=None): def redo(self, n_times=1, stop_on_mistake=None):
if self.insert_mode:
return
cn = self.current_node # avoid race conditions cn = self.current_node # avoid race conditions
for move in range(n_times): for move in range(n_times):
if cn.children: if cn.children:
+7 -7
View File
@@ -1,21 +1,21 @@
import base64
import copy import copy
import gzip
import json
import random import random
from typing import Dict, List, Optional, Tuple from typing import Dict, List, Optional, Tuple
from katrain.core.constants import ( from katrain.core.constants import (
VERSION, ANALYSIS_FORMAT_VERSION,
PROGRAM_NAME,
SGF_INTERNAL_COMMENTS_MARKER, SGF_INTERNAL_COMMENTS_MARKER,
SGF_SEPARATOR_MARKER, SGF_SEPARATOR_MARKER,
PROGRAM_NAME, VERSION,
ANALYSIS_FORMAT_VERSION,
) )
from katrain.core.lang import i18n from katrain.core.lang import i18n
from katrain.core.sgf_parser import Move, SGFNode from katrain.core.sgf_parser import Move, SGFNode
from katrain.core.utils import evaluation_class, var_to_grid, pack_floats, unpack_floats from katrain.core.utils import evaluation_class, pack_floats, unpack_floats, var_to_grid
from katrain.gui.style import INFO_PV_COLOR from katrain.gui.style import INFO_PV_COLOR
import base64
import gzip
import json
def analysis_dumps(analysis): def analysis_dumps(analysis):
+5
View File
@@ -755,6 +755,11 @@
icon: 'img/local.png' icon: 'img/local.png'
shortcut: 'g' shortcut: 'g'
on_action: root.katrain("analyze-extra", "local") on_action: root.katrain("analyze-extra", "local")
AnalysisMenuItem:
text: i18n._("analysis:insert")
icon: 'img/local.png'
shortcut: 'i'
on_action: root.katrain("insert-mode")
AnalysisMenuItem: AnalysisMenuItem:
text: i18n._("analysis:game") text: i18n._("analysis:game")
icon: 'img/analysis.png' icon: 'img/analysis.png'
+10 -7
View File
@@ -20,19 +20,19 @@ from kivymd.uix.floatlayout import MDFloatLayout
from katrain.core.constants import ( from katrain.core.constants import (
MODE_PLAY, MODE_PLAY,
OUTPUT_DEBUG, OUTPUT_DEBUG,
STATUS_TEACHING,
OUTPUT_EXTRA_DEBUG, OUTPUT_EXTRA_DEBUG,
TOP_MOVE_OPTIONS, STATUS_TEACHING,
TOP_MOVE_NOTHING,
TOP_MOVE_DELTA_SCORE, TOP_MOVE_DELTA_SCORE,
TOP_MOVE_SCORE,
TOP_MOVE_WINRATE,
TOP_MOVE_DELTA_WINRATE, TOP_MOVE_DELTA_WINRATE,
TOP_MOVE_NOTHING,
TOP_MOVE_OPTIONS,
TOP_MOVE_SCORE,
TOP_MOVE_VISITS, TOP_MOVE_VISITS,
TOP_MOVE_WINRATE,
) )
from katrain.core.game import Move from katrain.core.game import Move
from katrain.core.lang import i18n from katrain.core.lang import i18n
from katrain.core.utils import evaluation_class, var_to_grid, format_visits from katrain.core.utils import evaluation_class, format_visits, var_to_grid
from katrain.gui.kivyutils import BackgroundMixin, draw_circle, draw_text from katrain.gui.kivyutils import BackgroundMixin, draw_circle, draw_text
from katrain.gui.popups import I18NPopup, ReAnalyzeGamePopup from katrain.gui.popups import I18NPopup, ReAnalyzeGamePopup
from katrain.gui.style import * from katrain.gui.style import *
@@ -226,7 +226,10 @@ class BadukPanWidget(Widget):
for i in range(board_size_y) for i in range(board_size_y)
] ]
Color(1, 0.95, 0.8, 1) # image is a bit too light if katrain.game.insert_mode:
Color(1, 1, 1, 0.75) # dreamy
else:
Color(1, 0.95, 0.8, 1) # image is a bit too light
Rectangle( Rectangle(
pos=(self.gridpos_x[0] - self.grid_size * 1.5, self.gridpos_y[0] - self.grid_size * 1.5), pos=(self.gridpos_x[0] - self.grid_size * 1.5, self.gridpos_y[0] - self.grid_size * 1.5),
size=(self.grid_size * x_grid_spaces, self.grid_size * y_grid_spaces), size=(self.grid_size * x_grid_spaces, self.grid_size * y_grid_spaces),
+2 -2
View File
@@ -2,11 +2,11 @@ import time
from kivy.clock import Clock from kivy.clock import Clock
from kivy.core.audio import SoundLoader from kivy.core.audio import SoundLoader
from kivy.properties import ObjectProperty, OptionProperty, NumericProperty from kivy.properties import NumericProperty, ObjectProperty, OptionProperty
from kivy.uix.boxlayout import BoxLayout from kivy.uix.boxlayout import BoxLayout
from kivymd.uix.floatlayout import MDFloatLayout from kivymd.uix.floatlayout import MDFloatLayout
from katrain.core.constants import MODE_PLAY, MODE_ANALYZE, STATUS_ERROR, STATUS_ANALYSIS, PLAYER_HUMAN from katrain.core.constants import MODE_ANALYZE, MODE_PLAY, PLAYER_HUMAN, STATUS_ANALYSIS, STATUS_ERROR
from katrain.core.lang import rank_label from katrain.core.lang import rank_label
from katrain.gui.kivyutils import AnalysisToggle, CollapsablePanel from katrain.gui.kivyutils import AnalysisToggle, CollapsablePanel
+1 -2
View File
@@ -1,7 +1,6 @@
from kivy.clock import Clock from kivy.clock import Clock
from kivy.core.text import Label as CoreLabel from kivy.core.text import Label as CoreLabel
from kivy.core.text.markup import MarkupLabel as CoreMarkupLabel from kivy.core.text.markup import MarkupLabel as CoreMarkupLabel
from kivy.core.window import Window from kivy.core.window import Window
from kivy.graphics import * from kivy.graphics import *
from kivy.properties import ( from kivy.properties import (
@@ -12,7 +11,7 @@ from kivy.properties import (
OptionProperty, OptionProperty,
StringProperty, StringProperty,
) )
from kivy.uix.behaviors import ButtonBehavior, ToggleButtonBehavior, FocusBehavior from kivy.uix.behaviors import ButtonBehavior, FocusBehavior, ToggleButtonBehavior
from kivy.uix.boxlayout import BoxLayout from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button from kivy.uix.button import Button
from kivy.uix.label import Label from kivy.uix.label import Label
+1 -1
View File
@@ -16,7 +16,7 @@ GREEN = [0.1, 0.8, 0.1, 1]
YELLOW = [0.8, 0.8, 0.1, 1] YELLOW = [0.8, 0.8, 0.1, 1]
DARKRED = [0.3, 0.1, 0.1, 1] DARKRED = [0.3, 0.1, 0.1, 1]
ORANGE = [242 / 255, 96 / 255, 34 / 255, 1] ORANGE = [242 / 255, 96 / 255, 34 / 255, 1]
LIGHT_ORANGE = [1, 0.5, 0.25, 1]
# gui colors # gui colors
BACKGROUND_COLOR = [36 / 255, 48 / 255, 62 / 255, 1] BACKGROUND_COLOR = [36 / 255, 48 / 255, 62 / 255, 1]
BOX_BACKGROUND_COLOR = [46 / 255, 65 / 255, 88 / 255, 1] BOX_BACKGROUND_COLOR = [46 / 255, 65 / 255, 88 / 255, 1]
+2 -2
View File
@@ -1,6 +1,6 @@
from katrain.gui.widgets.graph import ScoreGraph, RankGraph
from katrain.gui.widgets.movetree import MoveTree
from katrain.gui.widgets.filebrowser import I18NFileBrowser from katrain.gui.widgets.filebrowser import I18NFileBrowser
from katrain.gui.widgets.graph import RankGraph, ScoreGraph
from katrain.gui.widgets.movetree import MoveTree
from katrain.gui.widgets.selection_slider import SelectionSlider from katrain.gui.widgets.selection_slider import SelectionSlider
__all__ = ["ScoreGraph", "RankGraph", "MoveTree", "I18NFileBrowser", "SelectionSlider"] __all__ = ["ScoreGraph", "RankGraph", "MoveTree", "I18NFileBrowser", "SelectionSlider"]
+21 -5
View File
@@ -12,8 +12,12 @@ from kivymd.app import MDApp
from katrain.gui.kivyutils import BackgroundMixin, draw_circle, draw_text from katrain.gui.kivyutils import BackgroundMixin, draw_circle, draw_text
from katrain.gui.style import ( from katrain.gui.style import (
BACKGROUND_COLOR, BACKGROUND_COLOR,
DARKRED,
GREEN,
LIGHT_ORANGE,
LIGHTER_BACKGROUND_COLOR, LIGHTER_BACKGROUND_COLOR,
LIGHTGREY, LIGHTGREY,
ORANGE,
OUTLINE_COLORS, OUTLINE_COLORS,
RED, RED,
STONE_COLORS, STONE_COLORS,
@@ -106,10 +110,9 @@ class MoveTreeCanvas(Widget):
return return
self.set_game_node(same_x_moves[new_index][1]) self.set_game_node(same_x_moves[new_index][1])
def draw_move_tree(self, current_node): def draw_move_tree(self, current_node, insert_node):
if not self.scroll_view_widget or not current_node: if not self.scroll_view_widget or not current_node:
return return
spacing = 5 spacing = 5
moves_vert = 3 moves_vert = 3
self.move_size = (self.scroll_view_widget.height - (moves_vert + 1) * spacing) / moves_vert self.move_size = (self.scroll_view_widget.height - (moves_vert + 1) * spacing) / moves_vert
@@ -148,6 +151,15 @@ class MoveTreeCanvas(Widget):
self.move_xy_pos = {n: xy_pos(x, y) for n, (x, y) in self.move_pos.items()} self.move_xy_pos = {n: xy_pos(x, y) for n, (x, y) in self.move_pos.items()}
special_nodes = {self.menu_selected_node: RED, current_node: YELLOW}
if insert_node:
special_nodes[insert_node.parent] = GREEN
insert_path = current_node
while insert_path != insert_node.parent and insert_path.parent:
special_nodes[insert_path] = ORANGE if insert_path == current_node else LIGHT_ORANGE
insert_path = insert_path.parent
with self.canvas: with self.canvas:
self.canvas.clear() self.canvas.clear()
Color(*LIGHTGREY) Color(*LIGHTGREY)
@@ -157,8 +169,8 @@ class MoveTreeCanvas(Widget):
Line(points=[x, y, x, cy, cx, cy], width=1) Line(points=[x, y, x, cy, cx, cy], width=1)
for node, pos in self.move_xy_pos.items(): for node, pos in self.move_xy_pos.items():
if node == self.menu_selected_node or node == current_node: if node in special_nodes:
Color(*(RED if node == self.menu_selected_node else YELLOW)) Color(*special_nodes[node])
Rectangle( Rectangle(
pos=[c - self.move_size / 2 - spacing / 2 for c in self.move_xy_pos[node]], pos=[c - self.move_size / 2 - spacing / 2 for c in self.move_xy_pos[node]],
size=(self.move_size + spacing, self.move_size + spacing), size=(self.move_size + spacing, self.move_size + spacing),
@@ -177,11 +189,15 @@ class MoveTree(ScrollView, BackgroundMixin):
def __init__(self, **kwargs): def __init__(self, **kwargs):
super().__init__(**kwargs) super().__init__(**kwargs)
self.insert_node = None
self.redraw_tree_trigger = Clock.create_trigger( self.redraw_tree_trigger = Clock.create_trigger(
lambda _dt: self.move_tree_canvas.draw_move_tree(self.current_node) lambda _dt: self.move_tree_canvas.draw_move_tree(self.current_node, self.insert_node)
) )
self.bind(current_node=self.redraw_tree_trigger, size=self.redraw_tree_trigger) self.bind(current_node=self.redraw_tree_trigger, size=self.redraw_tree_trigger)
def redraw(self):
self.redraw_tree_trigger()
def switch_branch(self, direction): def switch_branch(self, direction):
self.move_tree_canvas.switch_branch(direction) self.move_tree_canvas.switch_branch(direction)
Binary file not shown.
+14 -17
View File
@@ -671,23 +671,6 @@ msgstr ""
msgid "Make Main Branch" msgid "Make Main Branch"
msgstr "设为实战变化" msgstr "设为实战变化"
#. TODO - DEPRECATED
msgid "aihelp:settle"
msgstr ""
"Plays moves that lead to clarity on stones' status, favouring solid moves "
"rather than complex sabaki. Of moves that lose at most 'max_points_lost' "
"points and with at least 'min_visits', prefer moves that lose fewer points, "
"settle own stones more (with importance settled_weight), settle opponent's "
"stones more (importance settled_weight * opponent_fac), avoid tenuki (more "
"than 5 spaces, importance tenuki_penalty), and avoid attachments (importance"
" attachment_penalty). Weights can be negative to make it complicate the game"
" instead, and wide root noise (in general settings) can be used to further "
"play according to the style at the cost of strength. "
#. TODO - DEPRECATED
msgid "ai:settle"
msgstr "Settle Style"
#. TODO - setting: what to show on top move (e.g. point loss, visits, ...) #. TODO - setting: what to show on top move (e.g. point loss, visits, ...)
msgid "stats on top move" msgid "stats on top move"
msgstr "Stats on top moves" msgstr "Stats on top moves"
@@ -742,3 +725,17 @@ msgstr "Save SGF File"
# sgf save as button # sgf save as button
msgid "Save File" msgid "Save File"
msgstr "Save File" msgstr "Save File"
#. TODO - status message on starting insert mode
msgid "starting insert mode"
msgstr "Starting insert mode, press 'i' to finish inserting."
#. TODO - status message on ending insert mode and copying the moves
msgid "ending insert mode"
msgstr "Inserting exchange(s) done, copied {num_copied} following moves."
#. TODO - when a user tries to go to a different move/node while in insert
#. mode
msgid "finish inserting before navigating"
msgstr ""
"Navigation is disabled in insert mode, finish insert mode by pressing 'i'. "
Binary file not shown.
+14 -12
View File
@@ -707,18 +707,6 @@ msgstr ""
msgid "ai:simple" msgid "ai:simple"
msgstr "Einfacher Stil" msgstr "Einfacher Stil"
#. TODO - DEPRECATED
msgid "aihelp:settle"
msgstr ""
"Spielt Züge, die dazu zu einer Vereinfachung des Brettzustandes führen. Von "
"Zügen,die höchstens 'max_points_lost' Punkte verlieren und mit wenigstens "
"'min_visits' Visits, bevorzuge die Züge, die weniger Punkte verlieren, "
"eigenes Gebiet mehr sichern"
#. TODO - DEPRECATED
msgid "ai:settle"
msgstr "Settle Style"
msgid "analysis:local" msgid "analysis:local"
msgstr "Finde lokale Antworten" msgstr "Finde lokale Antworten"
@@ -789,3 +777,17 @@ msgstr "Save SGF File"
# sgf save as button # sgf save as button
msgid "Save File" msgid "Save File"
msgstr "Save File" msgstr "Save File"
#. TODO - status message on starting insert mode
msgid "starting insert mode"
msgstr "Starting insert mode, press 'i' to finish inserting."
#. TODO - status message on ending insert mode and copying the moves
msgid "ending insert mode"
msgstr "Inserting exchange(s) done, copied {num_copied} following moves."
#. TODO - when a user tries to go to a different move/node while in insert
#. mode
msgid "finish inserting before navigating"
msgstr ""
"Navigation is disabled in insert mode, finish insert mode by pressing 'i'. "
Binary file not shown.
+13 -17
View File
@@ -615,23 +615,6 @@ msgstr ""
"root noise (in general settings) can be used to increase play according to " "root noise (in general settings) can be used to increase play according to "
"the style at the cost of strength. " "the style at the cost of strength. "
#. DEPRECATED
msgid "ai:settle"
msgstr "Settle Style"
#. DEPRECATED
msgid "aihelp:settle"
msgstr ""
"Plays moves that lead to clarity on stones' status, favouring solid moves "
"rather than complex sabaki. Of moves that lose at most 'max_points_lost' "
"points and with at least 'min_visits', prefer moves that lose fewer points, "
"settle own stones more (with importance settled_weight), settle opponent's "
"stones more (importance settled_weight * opponent_fac), avoid tenuki (more "
"than 5 spaces, importance tenuki_penalty), and avoid attachments (importance"
" attachment_penalty). Weights can be negative to make it complicate the game"
" instead, and wide root noise (in general settings) can be used to further "
"play according to the style at the cost of strength. "
msgid "ai:jigo" msgid "ai:jigo"
msgstr "KataJigo" msgstr "KataJigo"
@@ -810,3 +793,16 @@ msgstr "---"
#. top move stats show threshold description #. top move stats show threshold description
msgid "show stats if" msgid "show stats if"
msgstr "Show stats if more than ... visits" msgstr "Show stats if more than ... visits"
#. status message on starting insert mode
msgid "starting insert mode"
msgstr "Starting insert mode, press 'i' to finish inserting."
#. status message on ending insert mode and copying the moves
msgid "ending insert mode"
msgstr "Inserting exchange(s) done, copied {num_copied} following moves."
#. when a user tries to go to a different move/node while in insert mode
msgid "finish inserting before navigating"
msgstr ""
"Navigation is disabled in insert mode, finish insert mode by pressing 'i'. "
Binary file not shown.
+14 -17
View File
@@ -713,23 +713,6 @@ msgstr "Plays moves that lead to simplifying the board state."
msgid "ai:simple" msgid "ai:simple"
msgstr "Simple Style" msgstr "Simple Style"
#. TODO - DEPRECATED
msgid "aihelp:settle"
msgstr ""
"Plays moves that lead to clarity on stones' status, favouring solid moves "
"rather than complex sabaki. Of moves that lose at most 'max_points_lost' "
"points and with at least 'min_visits', prefer moves that lose fewer points, "
"settle own stones more (with importance settled_weight), settle opponent's "
"stones more (importance settled_weight * opponent_fac), avoid tenuki (more "
"than 5 spaces, importance tenuki_penalty), and avoid attachments (importance"
" attachment_penalty). Weights can be negative to make it complicate the game"
" instead, and wide root noise (in general settings) can be used to further "
"play according to the style at the cost of strength. "
#. TODO - DEPRECATED
msgid "ai:settle"
msgstr "Settle Style"
#. TODO - Analyze again but allow only nearby moves #. TODO - Analyze again but allow only nearby moves
msgid "analysis:local" msgid "analysis:local"
msgstr "Find local responses" msgstr "Find local responses"
@@ -802,3 +785,17 @@ msgstr "Save SGF File"
# sgf save as button # sgf save as button
msgid "Save File" msgid "Save File"
msgstr "Save File" msgstr "Save File"
#. TODO - status message on starting insert mode
msgid "starting insert mode"
msgstr "Starting insert mode, press 'i' to finish inserting."
#. TODO - status message on ending insert mode and copying the moves
msgid "ending insert mode"
msgstr "Inserting exchange(s) done, copied {num_copied} following moves."
#. TODO - when a user tries to go to a different move/node while in insert
#. mode
msgid "finish inserting before navigating"
msgstr ""
"Navigation is disabled in insert mode, finish insert mode by pressing 'i'. "
Binary file not shown.
+14 -17
View File
@@ -743,23 +743,6 @@ msgstr ""
msgid "ai:simple" msgid "ai:simple"
msgstr "Modéré" msgstr "Modéré"
#. TODO - DEPRECATED
msgid "aihelp:settle"
msgstr ""
"Plays moves that lead to clarity on stones' status, favouring solid moves "
"rather than complex sabaki. Of moves that lose at most 'max_points_lost' "
"points and with at least 'min_visits', prefer moves that lose fewer points, "
"settle own stones more (with importance settled_weight), settle opponent's "
"stones more (importance settled_weight * opponent_fac), avoid tenuki (more "
"than 5 spaces, importance tenuki_penalty), and avoid attachments (importance"
" attachment_penalty). Weights can be negative to make it complicate the game"
" instead, and wide root noise (in general settings) can be used to further "
"play according to the style at the cost of strength. "
#. TODO - DEPRECATED
msgid "ai:settle"
msgstr "Settle Stones Style"
msgid "analysis:local" msgid "analysis:local"
msgstr "Proposer des coups locaux" msgstr "Proposer des coups locaux"
@@ -828,3 +811,17 @@ msgstr "Save SGF File"
# sgf save as button # sgf save as button
msgid "Save File" msgid "Save File"
msgstr "Save File" msgstr "Save File"
#. TODO - status message on starting insert mode
msgid "starting insert mode"
msgstr "Starting insert mode, press 'i' to finish inserting."
#. TODO - status message on ending insert mode and copying the moves
msgid "ending insert mode"
msgstr "Inserting exchange(s) done, copied {num_copied} following moves."
#. TODO - when a user tries to go to a different move/node while in insert
#. mode
msgid "finish inserting before navigating"
msgstr ""
"Navigation is disabled in insert mode, finish insert mode by pressing 'i'. "
Binary file not shown.
+14 -12
View File
@@ -698,18 +698,6 @@ msgstr ""
msgid "ai:simple" msgid "ai:simple"
msgstr "簡明派" msgstr "簡明派"
msgid "aihelp:settle"
msgstr ""
"複雑なサバキよりも, 石の生死をはっきりさせる堅実な手を好みます. 具体的には, 次の基準で手を選びます (括弧内は重視度): 損する目数が少ない, "
"自分の生死が明確 (settled_weight), 相手の生死も明確 (settled_weight × opponent fac), "
"相手が打った手の近辺…縦横とも3間以内 (tenuki_penalty), 相手の石に接触しない (attachment_penalty). ただし, "
"損が大きすぎたり (max_points_lost目以上) 探索手数が少なすぎたり (min_visits手未満) する候補手は除きます. "
"重視度を負にすれば, 逆に盤面の複雑化をめざします. また, 一般設定のwide root noiseを大きくすれば, 強さは犠牲になりますが, "
"より前述の基準に忠実な打ち方をします."
msgid "ai:settle"
msgstr "堅実派"
#. Analyze again but allow only nearby moves #. Analyze again but allow only nearby moves
msgid "analysis:local" msgid "analysis:local"
msgstr "近辺の応手に絞って分析" msgstr "近辺の応手に絞って分析"
@@ -781,3 +769,17 @@ msgstr "Save SGF File"
# sgf save as button # sgf save as button
msgid "Save File" msgid "Save File"
msgstr "Save File" msgstr "Save File"
#. TODO - status message on starting insert mode
msgid "starting insert mode"
msgstr "Starting insert mode, press 'i' to finish inserting."
#. TODO - status message on ending insert mode and copying the moves
msgid "ending insert mode"
msgstr "Inserting exchange done and copied {num_copied} following moves."
#. TODO - when a user tries to go to a different move/node while in insert
#. mode
msgid "finish inserting before navigating"
msgstr ""
"Navigation is disabled in insert mode, finish insert mode by pressing 'i'. "
Binary file not shown.
+14 -17
View File
@@ -682,23 +682,6 @@ msgstr ""
"이 판에 대해\n" "이 판에 대해\n"
"덤과 규칙 등 조절" "덤과 규칙 등 조절"
#. TODO - DEPRECATED
msgid "ai:settle"
msgstr "Settle Style"
#. TODO - DEPRECATED
msgid "aihelp:settle"
msgstr ""
"Plays moves that lead to clarity on stones' status, favouring solid moves "
"rather than complex sabaki. Of moves that lose at most 'max_points_lost' "
"points and with at least 'min_visits', prefer moves that lose fewer points, "
"settle own stones more (with importance settled_weight), settle opponent's "
"stones more (importance settled_weight * opponent_fac), avoid tenuki (more "
"than 5 spaces, importance tenuki_penalty), and avoid attachments (importance"
" attachment_penalty). Weights can be negative to make it complicate the game"
" instead, and wide root noise (in general settings) can be used to further "
"play according to the style at the cost of strength. "
msgid "Make Main Branch" msgid "Make Main Branch"
msgstr "주 변화로 만들기" msgstr "주 변화로 만들기"
@@ -756,3 +739,17 @@ msgstr "Save SGF File"
# sgf save as button # sgf save as button
msgid "Save File" msgid "Save File"
msgstr "Save File" msgstr "Save File"
#. TODO - status message on starting insert mode
msgid "starting insert mode"
msgstr "Starting insert mode, press 'i' to finish inserting."
#. TODO - status message on ending insert mode and copying the moves
msgid "ending insert mode"
msgstr "Inserting exchange(s) done, copied {num_copied} following moves."
#. TODO - when a user tries to go to a different move/node while in insert
#. mode
msgid "finish inserting before navigating"
msgstr ""
"Navigation is disabled in insert mode, finish insert mode by pressing 'i'. "
Binary file not shown.
+14 -16
View File
@@ -706,22 +706,6 @@ msgstr ""
msgid "ai:simple" msgid "ai:simple"
msgstr "Простой стиль" msgstr "Простой стиль"
msgid "aihelp:settle"
msgstr ""
"Делает ходы, ведущие к ясности в статусе камней, предпочитая надёжные ходы, "
"нежели сложное сабаки. Из ходов, теряющих не более чем 'max_points_lost' "
"очков и имеющих как минимум 'min_visits', предпочитает ходы, укрепляющие "
"собственную территорию (коэффициент settled_weight), укрепляющие территорию "
"оппонента (коэффициент settled_weight * opponent_fac), избегает тэнуки "
"(более 5 пунктов, коэффициент tenuki_penalty), и избегает прилипаний "
"(коэффициент attachment_penalty). Коэффициенты могут быть отрицательными, "
"чтобы напротив сделать игру сложнее. 'Уровень шума' (в 'Настройках системы')"
" может быть использован для увеличения вариативности игры за счёт небольшой "
"потери силы. "
msgid "ai:settle"
msgstr "Надёжный стиль"
msgid "analysis:local" msgid "analysis:local"
msgstr "Найти локальные ответы" msgstr "Найти локальные ответы"
@@ -790,3 +774,17 @@ msgstr "Save SGF File"
# sgf save as button # sgf save as button
msgid "Save File" msgid "Save File"
msgstr "Save File" msgstr "Save File"
#. TODO - status message on starting insert mode
msgid "starting insert mode"
msgstr "Starting insert mode, press 'i' to finish inserting."
#. TODO - status message on ending insert mode and copying the moves
msgid "ending insert mode"
msgstr "Inserting exchange(s) done, copied {num_copied} following moves."
#. TODO - when a user tries to go to a different move/node while in insert
#. mode
msgid "finish inserting before navigating"
msgstr ""
"Navigation is disabled in insert mode, finish insert mode by pressing 'i'. "
-1
View File
@@ -1,4 +1,3 @@
bson==0.5.10
certifi==2020.6.20 certifi==2020.6.20
chardet==3.0.4 chardet==3.0.4
Cython==0.29.14 Cython==0.29.14
+1 -2
View File
@@ -1,5 +1,5 @@
import re
import os import os
import re
from setuptools import find_packages, setup from setuptools import find_packages, setup
@@ -42,7 +42,6 @@ setup(
"wheel", "wheel",
"setuptools", "setuptools",
"urllib3", "urllib3",
"bson",
"importlib_resources ;python_version<'3.7'", "importlib_resources ;python_version<'3.7'",
"cython>=0.24,<=0.29.14,!=0.27,!=0.27.2", # kivy wants this "cython>=0.24,<=0.29.14,!=0.27,!=0.27.2", # kivy wants this
"kivy==2.0.0rc2;platform_system=='Darwin'", # rc3 failing on mac "kivy==2.0.0rc2;platform_system=='Darwin'", # rc3 failing on mac
+5 -4
View File
@@ -1,11 +1,12 @@
import pytest
import os import os
from katrain.core.ai import generate_ai_move, ai_rank_estimation
from katrain.core.constants import AI_STRATEGIES_RECOMMENDED_ORDER, AI_STRATEGIES, OUTPUT_INFO import pytest
from katrain.core.ai import ai_rank_estimation, generate_ai_move
from katrain.core.base_katrain import KaTrainBase from katrain.core.base_katrain import KaTrainBase
from katrain.core.constants import AI_STRATEGIES, AI_STRATEGIES_RECOMMENDED_ORDER, OUTPUT_INFO
from katrain.core.engine import KataGoEngine from katrain.core.engine import KataGoEngine
from katrain.core.game import Game from katrain.core.game import Game
from katrain.core.constants import AI_STRATEGIES
class TestAI: class TestAI:
+1 -1
View File
@@ -1,7 +1,7 @@
import pytest import pytest
from katrain.core.base_katrain import OUTPUT_INFO, KaTrainBase
from katrain.core.game import Game, IllegalMoveException, Move from katrain.core.game import Game, IllegalMoveException, Move
from katrain.core.base_katrain import KaTrainBase, OUTPUT_INFO
from katrain.core.game_node import GameNode from katrain.core.game_node import GameNode