diff --git a/THEMES.md b/THEMES.md
index 11d67e4..dce64fe 100644
--- a/THEMES.md
+++ b/THEMES.md
@@ -20,30 +20,37 @@ Version 1.7 brings basic support for themes, and 1.9 extends it to include keybo
* KaTrain supports different styles of display of expected territory:
* Blended style colors the board with an intensity proportional to the likelihood of a player controlling that territory at the end of the game.
+ * Shaded style behaves the same as Blended, but uses square shades similar to
+ the Katago paper.
* In the Marks style, each point of the board is marked with a square of size which is proportional to ownership likelihood.
* The Blocks style divides the whole board into black, white, and neutral territory, based on a likelihood threshold. This style is appropriate as a counting aid, but may be misleading before endgame if much of the territory is unsettled.
* Marks can also appear on stones to indicate the likelihood of these stones living at the end of the game. Three styles are supported:
* All stones can be marked, with the color of the mark indicating the expected ownership and the size of the mark indicating certainty.
* Weak stones only - marks will appear only on stones which are over 50% likely to die before the end of the game.
* No stone marks.
+* Stones can also be made transparent based on their strength.
-| 
Blended style, all stones marked | 
Marks on intersections, weak stones marked |
-|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
-| 
Territory blocks, no stones marked | 
Blended territory, weak stones marked |
+|
Blended style, all stones marked|
Shaded style, all stones marked |
+| --- | ---|
+|
Territory blocks, no stones marked |
Blended territory, weak stones marked |
+|
Marks on intersections, weak stones marked |
Shaded, no stone alpha |
The game used in the screenshots is [Albert Yen vs. Eric Yoder](https://www.usgo.org/news/2022/03/members-edition-midwest-open-round-2-the-broken-ladder-game).
-The stone marks and territory style are independent; the table above presents 4 possible variants out of 9.
+The stone marks, transparency, and territory style are independent; the table above presents a collection of possible variants.
The relevant variables are:
```
- TERRITORY_DISPLAY = "blended" | "marks" | "blocks"
+ TERRITORY_DISPLAY = "blended" | "shaded" | "marks" | "blocks"
STONE_MARKS = "all" | "weak" | "none"
- OWNERSHIP_MAX_ALPHA = 0.7
+ OWNERSHIP_COLORS = {"B": [0.0, 0.0, 0.10, 0.75], "W": [0.92, 0.92, 1.0, 0.800]}
BLOCKS_THRESHOLD = 0.6
MARK_SIZE = 0.42 # as fraction of stone size
+ STONE_MIN_ALPHA = 0.5
```
+The colors are specified as RGB values and a maximum alpha transparency.
+
## Installation
* To install a theme, simply unzip the theme.zip to your .katrain folder.
diff --git a/katrain/KataGo/katago b/katrain/KataGo/katago
index e1b1faa..117a875 100755
Binary files a/katrain/KataGo/katago and b/katrain/KataGo/katago differ
diff --git a/katrain/KataGo/katago.exe b/katrain/KataGo/katago.exe
index afb22c9..1f96b41 100644
Binary files a/katrain/KataGo/katago.exe and b/katrain/KataGo/katago.exe differ
diff --git a/katrain/config.json b/katrain/config.json
index 3014789..1157760 100644
--- a/katrain/config.json
+++ b/katrain/config.json
@@ -28,7 +28,7 @@
"anim_pv_time": 0.5,
"debug_level": 0,
"lang": "en",
- "version": "1.11.3",
+ "version": "1.12.1",
"load_fast_analysis": false,
"load_sgf_rewind": true
},
diff --git a/katrain/core/constants.py b/katrain/core/constants.py
index 15aa369..a95f06a 100644
--- a/katrain/core/constants.py
+++ b/katrain/core/constants.py
@@ -1,5 +1,5 @@
PROGRAM_NAME = "KaTrain"
-VERSION = "1.12.0"
+VERSION = "1.12.1"
HOMEPAGE = "https://github.com/sanderland/katrain"
CONFIG_MIN_VERSION = "1.11.0" # keep config files from this version
ANALYSIS_FORMAT_VERSION = "1.0"
diff --git a/katrain/gui/badukpan.py b/katrain/gui/badukpan.py
index 3f8f91d..ef9730d 100644
--- a/katrain/gui/badukpan.py
+++ b/katrain/gui/badukpan.py
@@ -237,6 +237,8 @@ class BadukPanWidget(Widget):
alpha = Theme.STONE_MIN_ALPHA + (1.0 - Theme.STONE_MIN_ALPHA) * abs(ownership)
else:
alpha = Theme.STONE_MIN_ALPHA
+ else:
+ (owner, other) = ("B", "W") # prevent errors in unused unset vars
Color(1, 1, 1, alpha)
Rectangle(
pos=(self.gridpos[y][x][0] - stone_size, self.gridpos[y][x][1] - stone_size),
@@ -251,11 +253,12 @@ class BadukPanWidget(Widget):
mark_color = *Theme.STONE_COLORS[owner][:3], 1.0
other_color = *Theme.STONE_COLORS[other][:3], 1.0
outline_color = tuple(map(lambda y: sum(y) / float(len(y)), zip(*(mark_color, other_color))))
- if loss is not None:
- mark_color = *Theme.EVAL_COLORS[self.trainer_config["theme"]][1][:3], loss
+ else:
+ assert loss is not None
+ mark_color = *Theme.EVAL_COLORS[self.trainer_config["theme"]][1][:3], 1
outline_color = mark_color
- mark_size = Theme.MARK_SIZE * abs(ownership if ownership else loss) * self.stone_size * 2.0
+ mark_size = Theme.MARK_SIZE * abs(ownership if ownership else min(1, loss)) * self.stone_size * 2.0
Color(*mark_color)
Rectangle(
pos=(
@@ -419,7 +422,7 @@ class BadukPanWidget(Widget):
def initialize_gridpos(self):
self.gridpos = [[None for x in range(len(self.initial_gridpos_x))] for y in range(len(self.initial_gridpos_y))]
- #[[None]*len(self.initial_gridpos_x)]*len(self.initial_gridpos_y)
+ # [[None]*len(self.initial_gridpos_x)]*len(self.initial_gridpos_y)
for y in range(len(self.initial_gridpos_y)):
for x in range(len(self.initial_gridpos_x)):
self.gridpos[y][x] = [self.initial_gridpos_x[x], self.initial_gridpos_y[y]]
@@ -638,7 +641,9 @@ class BadukPanWidget(Widget):
evalscale = min(1, max(0, realized_points_lost / points_lost))
placements = node.placements
for m in node.moves + placements:
- new_move = (current_node.move and m.coords == current_node.move.coords) and not current_node.ownership
+ new_move = (
+ current_node.move and m.coords == current_node.move.coords
+ ) and not current_node.ownership
if has_stone.get(m.coords) and not drawn_stone.get(m.coords): # skip captures, last only for
move_eval_on = not all_dots_off and show_dots_for.get(m.player) and i < show_n_eval
if move_eval_on and points_lost is not None:
@@ -742,9 +747,9 @@ class BadukPanWidget(Widget):
def draw_territory(self, grid, loss_color=None):
if Theme.TERRITORY_DISPLAY == "marks":
- self.draw_territory_marks(grid, loss_color=None)
+ self.draw_territory_marks(grid, loss_color)
else:
- self.draw_territory_color(grid, loss_color=None)
+ self.draw_territory_color(grid, loss_color)
def draw_territory_marks(self, grid, loss_color=None):
board_size_x, board_size_y = self.katrain.game.board_size
@@ -753,11 +758,11 @@ class BadukPanWidget(Widget):
if abs(grid[y][x]) < 0.01:
continue
(ix_owner, other) = ("B", "W") if grid[y][x] > 0 else ("W", "B")
- Color(
- *Theme.STONE_COLORS[ix_owner][:3],
- 1.0
- )
- rect_size = Theme.MARK_SIZE * abs(grid[y][x]) * self.stone_size * 2.0
+ if loss_color is None:
+ Color(*Theme.STONE_COLORS[ix_owner][:3], 1.0)
+ else:
+ Color(*loss_color[:3], 1.0)
+ rect_size = Theme.MARK_SIZE * min(1.0, abs(grid[y][x])) * self.stone_size * 2.0
Rectangle(
pos=(
self.gridpos[y][x][0] - rect_size / 2,
@@ -789,9 +794,11 @@ class BadukPanWidget(Widget):
alpha = 0
else:
alpha = abs(grid[y_coord][x_coord])
+ if alpha > 1:
+ alpha = 1
if Theme.TERRITORY_DISPLAY == "blocks":
alpha = 1 if alpha > Theme.BLOCKS_THRESHOLD else 0
- alpha = alpha**(1.0/Theme.OWNERSHIP_GAMMA)
+ alpha = alpha ** (1.0 / Theme.OWNERSHIP_GAMMA)
x_coord = max(0, min(x_coord, board_size_x - 1))
y_coord = max(0, min(y_coord, board_size_y - 1))
@@ -801,12 +808,12 @@ class BadukPanWidget(Widget):
pixel = Theme.OWNERSHIP_COLORS[ix_owner][:4]
pixel[3] *= alpha
else:
- pixel = *loss_color, min(1.0, alpha)
+ pixel = *loss_color, Theme.HINTS_ALPHA * alpha
pixel = tuple(map(lambda p: int(p * 255), pixel))
idx = 4 * y * (board_size_x + 2) + x * 4
bytes[idx : idx + 4] = pixel
- if Theme.TERRITORY_DISPLAY == "blocks":
+ if Theme.TERRITORY_DISPLAY == "blocks" or Theme.TERRITORY_DISPLAY == "shaded":
texture.mag_filter = "nearest"
texture.blit_buffer(bytes, colorfmt="rgba", bufferfmt="ubyte")
Color(1, 1, 1, 1)
diff --git a/katrain/gui/popups.py b/katrain/gui/popups.py
index a82ebdb..a1a6f82 100644
--- a/katrain/gui/popups.py
+++ b/katrain/gui/popups.py
@@ -471,6 +471,7 @@ class BaseConfigPopup(QuickConfigGui):
"20 block model": "https://github.com/lightvector/KataGo/releases/download/v1.4.5/g170e-b20c256x2-s5303129600-d1228401921.bin.gz",
"30 block model": "https://github.com/lightvector/KataGo/releases/download/v1.4.5/g170-b30c320x2-s4824661760-d1229536699.bin.gz",
"40 block model": "https://github.com/lightvector/KataGo/releases/download/v1.4.5/g170-b40c256x2-s5095420928-d1229425124.bin.gz",
+ "18 'nested residual block' model": "https://github.com/lightvector/KataGo/releases/download/v1.12.0/b18c384nbt-uec.bin.gz",
}
MODEL_DESC = {
"Fat 40 block model": "https://d3dndmfyhecmj0.cloudfront.net/g170/neuralnets/g170e-b40c384x2-s2348692992-d1229892979.zip",
@@ -479,22 +480,22 @@ class BaseConfigPopup(QuickConfigGui):
KATAGOS = {
"win": {
- "OpenCL v1.11.0": "https://github.com/lightvector/KataGo/releases/download/v1.11.0/katago-v1.11.0-opencl-windows-x64.zip",
- "Eigen AVX2 (Modern CPUs) v1.11.0": "https://github.com/lightvector/KataGo/releases/download/v1.11.0/katago-v1.11.0-eigenavx2-windows-x64.zip",
- "Eigen (CPU, Non-optimized) v1.11.0": "https://github.com/lightvector/KataGo/releases/download/v1.11.0/katago-v1.11.0-eigen-windows-x64.zip",
- "OpenCL v1.11.0 (bigger boards)": "https://github.com/lightvector/KataGo/releases/download/v1.11.0/katago-v1.11.0-opencl-windows-x64+bs29.zip",
+ "OpenCL v1.12.0": "https://github.com/lightvector/KataGo/releases/download/v1.12.0/katago-v1.12.0-opencl-windows-x64.zip",
+ "Eigen AVX2 (Modern CPUs) v1.12.0": "https://github.com/lightvector/KataGo/releases/download/v1.12.0/katago-v1.12.0-eigenavx2-windows-x64.zip",
+ "Eigen (CPU, Non-optimized) v1.12.0": "https://github.com/lightvector/KataGo/releases/download/v1.12.0/katago-v1.12.0-eigen-windows-x64.zip",
+ "OpenCL v1.12.0 (bigger boards)": "https://github.com/lightvector/KataGo/releases/download/v1.12.0/katago-v1.12.0-opencl-windows-x64+bs29.zip",
},
"linux": {
- "OpenCL v1.11.0": "https://github.com/lightvector/KataGo/releases/download/v1.11.0/katago-v1.11.0-opencl-linux-x64.zip",
- "Eigen AVX2 (Modern CPUs) v1.11.0": "https://github.com/lightvector/KataGo/releases/download/v1.11.0/katago-v1.11.0-eigenavx2-linux-x64.zip",
- "Eigen (CPU, Non-optimized) v1.11.0": "https://github.com/lightvector/KataGo/releases/download/v1.11.0/katago-v1.11.0-eigen-linux-x64.zip",
- "OpenCL v1.11.0 (bigger boards)": "https://github.com/lightvector/KataGo/releases/download/v1.11.0/katago-v1.11.0-opencl-linux-x64+bs29.zip",
+ "OpenCL v1.12.0": "https://github.com/lightvector/KataGo/releases/download/v1.12.0/katago-v1.12.0-opencl-linux-x64.zip",
+ "Eigen AVX2 (Modern CPUs) v1.12.0": "https://github.com/lightvector/KataGo/releases/download/v1.12.0/katago-v1.12.0-eigenavx2-linux-x64.zip",
+ "Eigen (CPU, Non-optimized) v1.12.0": "https://github.com/lightvector/KataGo/releases/download/v1.12.1/katago-v1.12.0-eigen-windows-x64.zip",
+ "OpenCL v1.12.0 (bigger boards)": "https://github.com/lightvector/KataGo/releases/download/v1.12.0/katago-v1.12.0-opencl-linux-x64+bs29.zip",
},
"just-descriptions": {
- "CUDA v1.11.0 (Windows)": "https://github.com/lightvector/KataGo/releases/download/v1.11.0/katago-v1.11.0-cuda11.2-windows-x64.zip",
- "CUDA v1.11.0 (Linux)": "https://github.com/lightvector/KataGo/releases/download/v1.11.0/katago-v1.11.0-cuda11.1-linux-x64.zip",
- "Cuda/TensorRT v1.11.0 (Windows)": "https://github.com/lightvector/KataGo/releases/download/v1.11.0/katago-v1.11.0-trt8.2-cuda11.2-windows-x64.zip",
- "Cuda/TensorRT v1.11.0 (Linux)": "https://github.com/lightvector/KataGo/releases/download/v1.11.0/katago-v1.11.0-trt8.2-cuda11.1-linux-x64.zip",
+ "CUDA v1.12.0 (Windows)": "https://github.com/lightvector/KataGo/releases/download/v1.12.0/katago-v1.12.0-cuda11.2-windows-x64.zip",
+ "CUDA v1.12.0 (Linux)": "https://github.com/lightvector/KataGo/releases/download/v1.12.0/katago-v1.12.0-cuda11.1-linux-x64.zip",
+ "Cuda/TensorRT v1.12.0 (Windows)": "https://github.com/lightvector/KataGo/releases/download/v1.12.0/katago-v1.12.1-trt8.2-cuda11.2-windows-x64.zip",
+ "Cuda/TensorRT v1.12.0 (Linux)": "https://github.com/lightvector/KataGo/releases/download/v1.12.0/katago-v1.12.1-trt8.2-cuda11.1-linux-x64.zip",
},
}
diff --git a/katrain/gui/theme.py b/katrain/gui/theme.py
index de6c501..c31c805 100644
--- a/katrain/gui/theme.py
+++ b/katrain/gui/theme.py
@@ -64,8 +64,7 @@ class Theme:
EVAL_DOT_TEXTURE = "dot.png"
LAST_MOVE_TEXTURE = "inner.png"
TOP_MOVE_TEXTURE = "topmove.png"
- BOARD_TEXTURE = "board.png"
- BOARD_TEXTURE = "wood6.jpg"
+ BOARD_TEXTURE = "wood6.jpg" # "board.png"
GRAPH_TEXTURE = "graph_bg.png"
# sounds
STONE_SOUNDS = [f"stone{i}.wav" for i in [1, 2, 3, 4, 5]]
@@ -123,14 +122,14 @@ class Theme:
POLICY_ALPHA = 0.5
OWNERSHIP_COLORS = {"B": [0.0, 0.0, 0.10, 0.75], "W": [0.92, 0.92, 1.0, 0.800]}
OWNERSHIP_GAMMA = 1.33
- STONE_MIN_ALPHA = 0.7 # the minimal alpha for dead/weak stones
+ STONE_MIN_ALPHA = 0.85 # the minimal alpha for dead/weak stones
- TERRITORY_DISPLAY = "blended" # other possibilities are "marks" and "blocks"
+ TERRITORY_DISPLAY = "blended" # other possibilities are "marks", "blocks" or "shaded"
BLOCKS_THRESHOLD = 0.3 # in "blocks" mode, territory which is this likely to be
# a certain player's gets his color
- STONE_MARKS = "all" # all: always display marks on stones
- # none: no marks on stones, indicate ownership by transparency only
- # weak: draw marks only on stones likely (>50%) to be captured
+ STONE_MARKS = "weak" # all: always display marks on stones
+ # none: no marks on stones, indicate ownership by transparency only (if STONE_MIN_ALPHA < 1.0)
+ # weak: draw marks only on stones likely (>50%) to be captured
MARK_SIZE = 0.42 # stone mark size as fraction of stone size
HINTS_LO_ALPHA = 0.6
diff --git a/requirements.txt b/requirements.txt
index 0a69d6c..aa4099b 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,4 @@
-certifi==2020.12.5
+certifi==2022.12.7
chardet==3.0.4
docutils==0.16
ffpyplayer==4.3.2
@@ -6,7 +6,7 @@ idna==2.10
Kivy==2.1.0
Kivy-Garden==0.1.4
kivymd==0.104.1
-Pillow==9.0.1
+Pillow==9.3.0
Pygments==2.7.4
requests==2.25.0
urllib3==1.26.5
\ No newline at end of file
diff --git a/themes/shaded-all.png b/themes/shaded-all.png
new file mode 100644
index 0000000..2b0fc68
Binary files /dev/null and b/themes/shaded-all.png differ
diff --git a/themes/shaded-no-alpha.png b/themes/shaded-no-alpha.png
new file mode 100644
index 0000000..fafc12e
Binary files /dev/null and b/themes/shaded-no-alpha.png differ