policy
This commit is contained in:
1 parent
8aaa85e73d
commit
c4ce996ef5
7 files changed
+64
-40
No files matched your search
@@ -174,6 +174,25 @@ class BadukPanWidget(Widget):
|
||||
Rectangle(pos=(self.gridpos[x] - rsz / 2, self.gridpos[y] - rsz / 2), size=(rsz, rsz))
|
||||
ix = ix + 1
|
||||
|
||||
policy = current_node.policy
|
||||
if katrain.controls.policy.active and policy and not katrain.controls.ownership.active:
|
||||
n_legal_moves = sum([p > 0 for p in policy])
|
||||
avg_policy = 1.0 / n_legal_moves
|
||||
best_move_policy = max(policy) # num legal moves scale?
|
||||
rsz = self.grid_size * 0.2
|
||||
ix = 0
|
||||
for y in range(board_size-1,-1,-1):
|
||||
for x in range(board_size):
|
||||
if policy[ix] > 0:
|
||||
policy_delta = best_move_policy - policy[ix]
|
||||
polcol = self.eval_color(0.1 * policy_delta / avg_policy)
|
||||
Color(*polcol)
|
||||
Rectangle(pos=(self.gridpos[x] - rsz / 2, self.gridpos[y] - rsz / 2), size=(rsz, rsz))
|
||||
else:
|
||||
ix = ix + 1
|
||||
policy_delta = best_move_policy - policy[ix]
|
||||
katrain.controls.pass_btn.face_color = (*self.eval_color(100*policy_delta),1)
|
||||
|
||||
# children of current moves in undo / review
|
||||
undo_coords = set()
|
||||
alpha = self.ui_config["_child_alpha"]
|
||||
@@ -201,6 +220,7 @@ class BadukPanWidget(Widget):
|
||||
scale = 0.85
|
||||
self.draw_stone(move.coords[0], move.coords[1], c, scale=scale)
|
||||
|
||||
|
||||
# hover next move ghost stone
|
||||
if self.ghost_stone:
|
||||
self.draw_stone(*self.ghost_stone, (*stone_color[next_player], _ghost_alpha))
|
||||
|
||||
+2
-15
@@ -1,17 +1,4 @@
|
||||
import copy
|
||||
import json
|
||||
import os
|
||||
import random
|
||||
import re
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
|
||||
from kivy.uix.boxlayout import BoxLayout
|
||||
from kivy.uix.checkbox import CheckBox
|
||||
from kivy.uix.filechooser import FileChooserListView
|
||||
from kivy.uix.gridlayout import GridLayout
|
||||
from kivy.uix.label import Label
|
||||
|
||||
|
||||
class Controls(BoxLayout):
|
||||
@@ -43,8 +30,8 @@ class Controls(BoxLayout):
|
||||
|
||||
def unlock(self):
|
||||
if self.ai_lock.active:
|
||||
self.ai_lock.checkbox._do_press()
|
||||
for el in [self.ai_lock.checkbox, self.hints.black, self.hints.white, self.ai_auto.black, self.ai_auto.white, self.auto_undo.black, self.auto_undo.white, self.ai_move]:
|
||||
self.ai_lock.checkbox.trigger_action(duration=0)
|
||||
for el in [self.ai_lock.checkbox, self.analyze_tab_button, self.ai_auto.white, self.ai_auto.black, self.ai_move]:
|
||||
el.disabled = False
|
||||
|
||||
# handles showing completed analysis and triggered actions like auto undo and ai move
|
||||
|
||||
Reference in new issue
Block a user