fix newgame

This commit is contained in:
Sander Land committed 2020-05-01 12:26:51 +02:00
1 parent 3ed0b9f3ce
commit 2664079d35
5 files changed
+14 -10

No files matched your search

-1
View File
@@ -120,4 +120,3 @@ while True:
break
print(f"= \n")
sys.stdout.flush()
+4 -2
View File
@@ -1,7 +1,6 @@
import json
import os
import sys
from bots.settings import bot_strategy_names, greetings
if len(sys.argv) < 2:
@@ -9,7 +8,10 @@ if len(sys.argv) < 2:
bot = sys.argv[1].strip()
port = int(sys.argv[2]) if len(sys.argv) > 2 else 8587
MAXGAMES = 10
GTP2OGS = "node ../gtp2ogs"
# GTP2OGS = "gtp2ogs"
BOT_SETTINGS = f" --maxconnectedgames {MAXGAMES} --noautohandicap --maxhandicap 0 --boardsizes 19"
username = f"katrain-{bot}"
@@ -37,6 +39,6 @@ BYEMSG = (
"Thank you for playing. If you have any feedback, please message my admin! Please note that score estimates in the malkovich log are based on low visits and likely inaccurate."
)
cmd = f'gtp2ogs --debug --apikey {APIKEY} --username {username} --greeting "{GREETING}" --farewell "{BYEMSG}" {BOT_SETTINGS} --aichat --noclock --nopause --speeds blitz,live --persist --minrank 25k --komis automatic,6.5,7.5 -- python bots/ai2gtp.py {bot} {port}'
cmd = f'{GTP2OGS} --debug --apikey {APIKEY} --username {username} --greeting "{GREETING}" --farewell "{BYEMSG}" {BOT_SETTINGS} --farewell_score --aichat --noclock --nopause --speeds blitz,live --persist --minrank 25k --komis automatic,6.5,7.5 -- python bots/ai2gtp.py {bot} {port}'
print(f"starting bot {username} using server port {port} --> {cmd}")
os.system(cmd)
+1
View File
@@ -211,6 +211,7 @@ class Game:
hi_threshold = 0.85
max_unknown = 10
max_dame = 4 * (board_size_x + board_size_y)
def japanese_score_square(square, owner):
player = stones.get(square, None)
if (player == "B" and owner > hi_threshold) or (player == "W" and owner < -hi_threshold) or abs(owner) < lo_threshold:
+1 -1
View File
@@ -275,7 +275,7 @@ class BadukPanWidget(Widget):
passed = len(nodes) > 1 and current_node.is_pass
if passed:
if game_ended:
text = katrain.game.manual_score or 'game\nend'
text = katrain.game.manual_score or "game\nend"
else:
text = "pass"
Color(0.45, 0.05, 0.45, 0.7)
+8 -6
View File
@@ -33,6 +33,7 @@ class KaTrainGui(BoxLayout):
self.debug_level = 0
self.engine = None # type: Optional[KataGoEngine]
self.game = None
self.new_game_popup = None
self.fileselect_popup = None
self.config_popup = None
self.logger = lambda message, level=OUTPUT_INFO: self.log(message, level)
@@ -179,7 +180,7 @@ class KaTrainGui(BoxLayout):
def _do_analyze_sgf_popup(self):
if not self.fileselect_popup:
self.fileselect_popup = Popup(title="Double Click SGF file to analyze", size_hint=(0.8, 0.8))
self.fileselect_popup = Popup(title="Double Click SGF file to analyze", size_hint=(0.8, 0.8)).__self__
popup_contents = LoadSGFPopup()
self.fileselect_popup.add_widget(popup_contents)
popup_contents.filesel.path = os.path.expanduser(self.config("sgf/sgf_load"))
@@ -197,14 +198,15 @@ class KaTrainGui(BoxLayout):
self.fileselect_popup.open()
def _do_new_game_popup(self):
new_game_popup = Popup(title="New Game", size_hint=(0.5, 0.6))
popup_contents = NewGamePopup(self, new_game_popup, {k: v[0] for k, v in self.game.root.properties.items() if len(v) == 1})
new_game_popup.add_widget(popup_contents)
new_game_popup.open()
if not self.new_game_popup:
self.new_game_popup = Popup(title="New Game", size_hint=(0.5, 0.6)).__self__
popup_contents = NewGamePopup(self, self.new_game_popup, {k: v[0] for k, v in self.game.root.properties.items() if len(v) == 1})
self.new_game_popup.add_widget(popup_contents)
self.new_game_popup.open()
def _do_config_popup(self):
if not self.config_popup:
self.config_popup = Popup(title="Edit Settings", size_hint=(0.9, 0.9))
self.config_popup = Popup(title="Edit Settings", size_hint=(0.9, 0.9)).__self__
popup_contents = ConfigPopup(self, self.config_popup, dict(self._config), ignore_cats=("trainer", "ai"))
self.config_popup.add_widget(popup_contents)
self.config_popup.open()