Skip to content

Commit

Permalink
1.11 (#492)
Browse files Browse the repository at this point in the history
* Shade estimated territory (#488)
* prune branch, icons
* Tsumego frame (#506)
* straighten quotes
* Bump pillow from 9.0.0 to 9.0.1 (#511)
* Bump pillow from 8.3.2 to 9.0.0 (#500)
* Add option to display higher precision point loss values (#514)
* fix mac build (#516)
* drop 3.6 support
* new katago

Co-authored-by: Miles Crawford <miles@milescrawford.com>
Co-authored-by: kaorahi <38910552+kaorahi@users.noreply.github.com>
Co-authored-by: Hiraoka <khi@users.osdn.me>
Co-authored-by: Zironic <Tony-Liou@users.noreply.github.com>
Co-authored-by: pdeblanc <peter@spaceandgames.com>
Co-authored-by: Dontbtme <66470440+Dontbtme@users.noreply.github.com>
  • Loading branch information
7 people committed Mar 24, 2022
1 parent dcc3b6f commit 2ffb79a
Show file tree
Hide file tree
Showing 51 changed files with 2,017 additions and 272 deletions.
34 changes: 21 additions & 13 deletions .github/workflows/osxbuild.yaml
Expand Up @@ -4,11 +4,10 @@ on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
osx_app:
runs-on: macos-10.15
osx_app:
runs-on: macos-11
steps:
- uses: actions/checkout@v2
- name: Set up Python
Expand All @@ -32,35 +31,45 @@ jobs:
cmake . -DUSE_BACKEND=OPENCL -DBUILD_DISTRIBUTED=1
make
cp katago ../../katrain/katrain/KataGo/katago-osx
- name: Install platypus
run: |
curl -L --output "platypus.zip" https://github.com/sveinbjornt/Platypus/releases/download/5.3/platypus5.3.zip
unzip "platypus.zip"
gunzip Platypus.app/Contents/Resources/platypus_clt.gz
gunzip Platypus.app/Contents/Resources/ScriptExec.gz
mkdir -p /usr/local/bin
mkdir -p /usr/local/share/platypus
cp Platypus.app/Contents/Resources/platypus_clt /usr/local/bin/platypus
cp Platypus.app/Contents/Resources/ScriptExec /usr/local/share/platypus/ScriptExec
cp -a Platypus.app/Contents/Resources/MainMenu.nib /usr/local/share/platypus/MainMenu.nib
chmod -R 755 /usr/local/share/platypus
- name: Get Kivy dependencies
run: |
cd ..
git clone https://github.com/kivy/kivy-sdk-packager.git
cd kivy-sdk-packager/osx
curl -O -L https://kivy.org/downloads/ci/osx/app/Kivy.dmg
hdiutil attach Kivy.dmg -mountroot .
cp -R Kivy/Kivy.app KaTrain.app
./create-osx-bundle.sh -n "KaTrain" -a "Sander Land" -o "org.katrain.KaTrain" -i "../../katrain/katrain/img/icon.ico"
- name: Install KaTrain pip dependencies
run: |
pushd ../kivy-sdk-packager/osx/KaTrain.app/Contents/Resources/venv/bin
pushd ../kivy-sdk-packager/osx/build/KaTrain.app/Contents/Resources/venv/bin
source activate
popd
python -m pip install .
- name: Finalize KaTrain bundle
run: |
export KATRAIN_VERSION=`python -c 'from katrain.core.constants import VERSION;print(VERSION)' `
echo "Setting version to ${KATRAIN_VERSION}"
cd ../kivy-sdk-packager/osx
cd ../kivy-sdk-packager/osx/build
pushd KaTrain.app/Contents/Resources/
ln -s ./venv/bin/KaTrain yourapp
popd
./fix-bundle-metadata.sh KaTrain.app -n KaTrain -v "${KATRAIN_VERSION}" -a "Sander Land" -o "org.katrain.KaTrain" -i "../../katrain/katrain/img/icon.ico"
./cleanup-app.sh KaTrain.app -g 1
./relocate.sh KaTrain.app
../fix-bundle-metadata.sh KaTrain.app -n KaTrain -v "${KATRAIN_VERSION}" -a "Sander Land" -o "org.katrain.KaTrain" -i "../../katrain/katrain/img/icon.ico"
../cleanup-app.sh KaTrain.app
../relocate.sh KaTrain.app
- name: Create dmg
run: |
pushd ../kivy-sdk-packager/osx
./create-osx-dmg.sh KaTrain.app KaTrain
./create-osx-dmg.sh build/KaTrain.app KaTrain
popd
mkdir osx_app
cp ../kivy-sdk-packager/osx/KaTrain.dmg osx_app/
Expand All @@ -69,4 +78,3 @@ jobs:
with:
name: KaTrainOSX
path: osx_app

2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
Expand Down
5 changes: 3 additions & 2 deletions CONTRIBUTIONS.md
Expand Up @@ -45,15 +45,16 @@ Many thanks to these additional authors:
* "nimets123" for the timer sound effects and board/stone graphics.
* Jordan Seaward for the stone sound effects.
* "fohristiwhirl" for the Gibo and NGF formats parsing code.
* "kaorahi" for bug fixes and SGF parser improvements.
* "kaorahi" for bug fixes, SGF parser improvements, and tsumego frame code.
* "ajkenny84" for the red-green colourblind theme.
* Lukasz Wierzbowski for the ability to paste urls for sgfs and helping fix alt-gr issues.
* Carton He for contributions to sgf parsing and handling.
* "blamarche" for adding the board coordinates toggle.
* "pdeblanc" for adding the ancient chinese scoring option, fixing a bug in query termination
* "pdeblanc" for adding the ancient chinese scoring option, fixing a bug in query termination, and high precision score display.
* "LiamHz" for adding the 'back to main branch' keyboard shortcut.
* "xiaoyifang" for adding the reset analysis option, feature to save options on the loading screen, and scrolling through variations.
* "electricRGB" for help with adding configurable keyboard shortcuts.
* "milescrawford" for work on restyling the territory estimate.

## Translators

Expand Down
13 changes: 5 additions & 8 deletions ENGINE.md
Expand Up @@ -62,14 +62,11 @@ Run DebugKaTrain.exe, which is released in the .zip file distributable in releas

### libzip compatibility

The most common KataGo issue relates to different libzip versions in the provided executables,
leading to an "Error 127".
Although the provided executables should work on the latest versions of Ubuntu with libzip installed,
various other versions and distros differ in their libzip version.

* First, try `****sudo apt-get install libzip-dev****` to get this library on recent systems.
* Next, try installing all packages mentioned [here](INSTALL.md#LinuxTrouble).
* A final alternative is to go [here](https://github.com/lightvector/KataGo) and compile KataGo yourself.
The most common KataGo issue relates to incompatible library versions, leading to an "Error 127".

* A good alternative is to go [here](https://github.com/lightvector/KataGo) and compile KataGo yourself.
* Installing dependencies mentioned [here](INSTALL.md#LinuxTrouble) may also resolve certain issues with KataGo or the gui.


### Getting more information about errors

Expand Down
1 change: 1 addition & 0 deletions LICENSE
Expand Up @@ -7,6 +7,7 @@ For on related licenses for these binaries and libraries see https://github.com/
- Equalize icon and Thrash Icon: derived from work by bqlqn from www.flaticon.com
- Other Menu icons, Finish, Collaboration, and Flag icons: derived from work by Freepik from www.flaticon.com
- Collapse branch icon: derived from work by Kirill Kazachek from www.flaticon.com
- Prune icon: derived from work by Pixelmeetup from www.flaticon.com
- Reset icon: derived from work by Pixel Perfect from www.flaticon.com

3. The True Type Font DIGITAL-7 version 1.02 by Sizenko Alexander, which is free for non-commercial use.
Expand Down
26 changes: 18 additions & 8 deletions README.md
Expand Up @@ -38,6 +38,7 @@ KaTrain is a tool for analyzing games and playing go with AI feedback from KataG
<a href="http://translate.google.com/translate?sl=en&tl=de&u=https%3A%2F%2Fgithub.com%2Fsanderland%2Fkatrain%2Fblob%2Fmaster%2FREADME.md"><img alt="German" src="https://github.com/sanderland/katrain/blob/master/katrain/img/flags/flag-de.png" width=50></a>
<a href="http://translate.google.com/translate?sl=en&tl=fr&u=https%3A%2F%2Fgithub.com%2Fsanderland%2Fkatrain%2Fblob%2Fmaster%2FREADME.md"><img alt="French" src="https://github.com/sanderland/katrain/blob/master/katrain/img/flags/flag-fr.png" width=50></a>
<a href="http://translate.google.com/translate?sl=en&tl=ru&u=https%3A%2F%2Fgithub.com%2Fsanderland%2Fkatrain%2Fblob%2Fmaster%2FREADME.md"><img alt="Russian" src="https://github.com/sanderland/katrain/blob/master/katrain/img/flags/flag-ru.png" width=50></a>
<a href="http://translate.google.com/translate?sl=en&tl=tr&u=https%3A%2F%2Fgithub.com%2Fsanderland%2Fkatrain%2Fblob%2Fmaster%2FREADME.md"><img alt="Turkish" src="https://github.com/sanderland/katrain/blob/master/katrain/img/flags/flag-tr.png" width=50></a>
<br/>

<a href="http://translate.google.com/translate?sl=en&tl=zh-CN&u=https%3A%2F%2Fgithub.com%2Fsanderland%2Fkatrain%2Fblob%2Fmaster%2FREADME.md"><img alt="Simplified Chinese" src="https://github.com/sanderland/katrain/blob/master/katrain/img/flags/flag-cn.png" width=50></a>
Expand Down Expand Up @@ -111,12 +112,13 @@ This estimate should be reasonably accurate as long as you have not changed the
game from the opening to the endgame without making serious (DDK) blunders. Further discussion can be found
[here](http://github.com/sanderland/katrain/issues/44) and [here](http://github.com/sanderland/katrain/issues/74).
* **Simple Style** Prefers moves that solidify both player's territory, leading to relatively simpler moves.
* Legacy options which were developed earlier include:
* **ScoreLoss** is KataGo analyzing as usual, but
choosing from potential moves depending on the expected score loss, leading to a varied style with mostly small mistakes.
* **Policy** uses the top move from the policy network (it's 'shape sense' without reading).
* **Policy Weighted** picks a random move weighted by the policy, leading to a varied style with mostly small mistakes, and occasional blunders due to a lack of reading.
* **Blinded Policy** picks a number of moves at random and play the best move among them, being effectively 'blind' to part of the board each turn. Calibrated rank is based on the same idea, and recommended over this option.
* Options that are more on the 'fun and experimental' side include:
* Options that are more on the 'fun and experimental' side include:
* Variants of **Blinded Policy**, which use the same basic strategy, but with a twist:
* **Local Style** will consider mostly moves close to the last move.
* **Tenuki Style** will consider mostly moves away from the last move.
Expand All @@ -128,7 +130,7 @@ This estimate should be reasonably accurate as long as you have not changed the
The Engine based AIs (KataGo, ScoreLoss, KataJigo) are affected by both the model and choice of visits and maximum time,
while the policy net based AIs are affected by the choice of model file, but work identically with 1 visit.

Further technical details and discussion on these AIs can be found on [this](http://lifein19x19.com/viewtopic.php?f=10&t=17488&sid=b11e42c005bb6f4f48c83771e6a27eff) thread at the life in 19x19 forums.
Further technical details and discussion on some of these AIs can be found on [this](http://lifein19x19.com/viewtopic.php?f=10&t=17488&sid=b11e42c005bb6f4f48c83771e6a27eff) thread at the life in 19x19 forums.

## <a name="analysis"></a> Analysis

Expand Down Expand Up @@ -166,7 +168,11 @@ Keyboard shortcuts are shown with **[key]**.
* **[l]**: Play out the game until the end and add as a collapsed branch, to visualize the potential effect of mistakes. This is done in the background, and can be started at several nodes at once when comparing the results at different starting positions.
* **[spacebar]**: Turn continuous analysis on/off. This will continuously improve analysis of the current position, similar to Lizzie's 'pondering', but only when there are no other queries going on.
* **[enter]** AI move. Makes the AI move for the current player regardless of current player selection.

* **[F2]**: Deeper full game analysis. Analyze the entire game to a higher number of visits.
* **[F3]**: Performance report. Show an overview of performance statistics for both players.
* **[F10]**: Tsumego Frame. After placing a life and death problem in a corner/side, use this to fill up the rest of the board to improve AI's ability in solving life and death problems.


## <a name="keyboard"></a> Keyboard and mouse shortcuts

In addition to shortcuts mentioned above and those shown in the main menu:
Expand Down Expand Up @@ -202,12 +208,18 @@ Starting in December 2020, KataGo started [distributed training](https://katagot
This allows people to all help generate self-play games to increase KataGo's strength and train bigger models.

KaTrain 1.8.0+ makes it easy to contribute to distributed training: simply select the option from the main menu, register an account, and click run.

During this mode you can do little more than watch games. Toggling continuous analysis (spacebar) will allow you to switch between manually navigating the current game, and automatically advancing it.
During this mode you can do little more than watch games.

Keep in mind that partial games are not uploaded,
so it is best to plan to keep it running for at least an hour, if not several, for the most effective contribution.

A few keyboard shortcuts have special functions in this mode:

* **[Spacebar]** Switch between manually navigating the current game, and automatically advancing it.
* **[Escape]**: This sends the `quit` command to KataGo, which starts a slow shutdown, finishing partial games but not starting new ones. Only works on v1.11+.
* **[Pause]**: Pauses/resumes contributions via the `pause` and `resume` commands introduced in KataGo v1.11.


## <a name="themes"></a> Themes

See [these instructions](THEMES.md) for how to modify the look of any graphics or colours, and creating or install themes.
Expand All @@ -229,13 +241,11 @@ See [these instructions](THEMES.md) for how to modify the look of any graphics o
## <a name="support"></a> Support / Contribute

[![GitHub issues](http://img.shields.io/github/issues/sanderland/katrain)](http://github.com/sanderland/katrain/issues)
[![Contributors](http://img.shields.io/static/v1?label=contributors&message=26&color=dcb424)](CONTRIBUTIONS.md)
[![Github sponsors](http://img.shields.io/static/v1?label=sponsor&message=%E2%9D%A4&logo=GitHub&color=dcb424&link=http://github.com/sponsors/sanderland/)](http://github.com/sponsors/sanderland)
[![Contributors](http://img.shields.io/static/v1?label=contributors&message=<3&color=dcb424)](CONTRIBUTIONS.md)

* Ideas, feedback, and contributions to code or translations are all very welcome.
* For suggestions and planned improvements, see [open issues](http://github.com/sanderland/katrain/issues) on github to check if the functionality is already planned.
* You can contact me on the [Leela Zero & Friends Discord](http://discord.gg/AjTPFpN) (use the #gui channel) to get help, discuss improvements, or simply show your appreciation.
* You can also donate to the project through [Github Sponsors](http://github.com/sponsors/sanderland).



6 changes: 5 additions & 1 deletion i18n.py
Expand Up @@ -16,14 +16,16 @@
lang_to_strings = defaultdict(set)

DEFAULT_LANG = "en"

INACTIVE_LANGS = ["es"]
errors = False

po = {}
pofile = {}
todos = defaultdict(list)

for lang in locales:
if lang in INACTIVE_LANGS:
continue
pofile[lang] = os.path.join(localedir, lang, "LC_MESSAGES", "katrain.po")
po[lang] = polib.pofile(pofile[lang])
for entry in po[lang].translated_entries():
Expand All @@ -44,6 +46,8 @@


for lang in locales:
if lang in INACTIVE_LANGS:
continue
if lang != DEFAULT_LANG:
for msgid in lang_to_strings[lang]:
if (
Expand Down
Binary file modified katrain/KataGo/katago
Binary file not shown.
Binary file modified katrain/KataGo/katago.exe
Binary file not shown.
37 changes: 37 additions & 0 deletions katrain/__main__.py
Expand Up @@ -488,6 +488,30 @@ def _do_engine_recovery_popup(self, error_message, code):
popup.content.popup = popup
popup.open()

def _do_tsumego_frame(self, ko, margin):
from katrain.core.tsumego_frame import tsumego_frame_from_katrain_game

if not self.game.stones:
return

black_to_play_p = self.next_player_info.player == "B"
node, analysis_region = tsumego_frame_from_katrain_game(
self.game, self.game.komi, black_to_play_p, ko_p=ko, margin=margin
)
self.game.set_current_node(node)
if self.play_mode.mode == MODE_PLAY:
self.play_mode.switch_ui_mode() # go to analysis mode
if analysis_region:
flattened_region = [
analysis_region[0][1],
analysis_region[0][0],
analysis_region[1][1],
analysis_region[1][0],
]
self.game.set_region_of_interest(flattened_region)
node.analyze(self.game.engines[node.next_player])
self.update_state(redraw_board=True)

def play_mistake_sound(self, node):
if self.config("timer/sound") and node.played_sound is None and Theme.MISTAKE_SOUNDS:
node.played_sound = True
Expand Down Expand Up @@ -665,9 +689,11 @@ def _on_keyboard_down(self, _keyboard, keycode, _text, modifiers):
Theme.KEY_TEACHER_POPUP,
Theme.KEY_AI_POPUP,
Theme.KEY_CONFIG_POPUP,
Theme.KEY_TSUMEGO_FRAME,
Theme.KEY_CONTRIBUTE_POPUP,
]: # switch between popups
popup.dismiss()

return
elif keycode[1] in Theme.KEY_SUBMIT_POPUP:
fn = getattr(popup.content, "on_submit", None)
Expand All @@ -676,6 +702,15 @@ def _on_keyboard_down(self, _keyboard, keycode, _text, modifiers):
return
else:
return

if self.contributing:
if keycode[1] == Theme.KEY_STOP_CONTRIBUTING:
self.engine.graceful_shutdown()
return
elif keycode[1] in Theme.KEY_PAUSE_CONTRIBUTE:
self.engine.pause()
return

if keycode[1] == Theme.KEY_TOGGLE_CONTINUOUS_ANALYSIS:
self.toggle_continuous_analysis()
elif keycode[1] == Theme.KEY_TOGGLE_COORDINATES:
Expand Down Expand Up @@ -717,6 +752,8 @@ def _on_keyboard_down(self, _keyboard, keycode, _text, modifiers):
self("undo", "main-branch")
elif keycode[1] == Theme.KEY_DEEPERANALYSIS_POPUP:
self.analysis_controls.dropdown.open_game_analysis_popup()
elif keycode[1] == Theme.KEY_TSUMEGO_FRAME:
self.analysis_controls.dropdown.open_tsumego_frame_popup()
elif keycode[1] == Theme.KEY_REPORT_POPUP:
self.analysis_controls.dropdown.open_report_popup()
elif keycode[1] == "f10" and self.debug_level >= OUTPUT_EXTRA_DEBUG:
Expand Down
5 changes: 3 additions & 2 deletions katrain/config.json
Expand Up @@ -28,7 +28,7 @@
"anim_pv_time": 0.5,
"debug_level": 0,
"lang": "en",
"version": "1.10.0",
"version": "1.11.0",
"load_fast_analysis": false,
"load_sgf_rewind": true
},
Expand Down Expand Up @@ -82,6 +82,7 @@
true,
true
],
"extra_precision": false,
"save_analysis": false,
"save_marks": false,
"low_visits": 25,
Expand Down Expand Up @@ -231,4 +232,4 @@
}
}
}
}
}
4 changes: 2 additions & 2 deletions katrain/core/constants.py
@@ -1,7 +1,7 @@
PROGRAM_NAME = "KaTrain"
VERSION = "1.10.1"
VERSION = "1.11.0"
HOMEPAGE = "https://github.com/sanderland/katrain"
CONFIG_MIN_VERSION = "1.10.0" # keep config files from this version
CONFIG_MIN_VERSION = "1.11.0" # keep config files from this version
ANALYSIS_FORMAT_VERSION = "1.0"
DATA_FOLDER = "~/.katrain"

Expand Down

0 comments on commit 2ffb79a

Please sign in to comment.