moving towards json engine
This commit is contained in:
1 parent
dcc80c6ad3
commit
38d9fb5708
3 files changed
+5
-4
No files matched your search
+1
-1
@@ -32,7 +32,7 @@ class EngineControls(GridLayout):
|
||||
|
||||
@property
|
||||
def stones(self):
|
||||
return self.engine.stones
|
||||
return self.engine.board.stones
|
||||
|
||||
@property
|
||||
def moves(self):
|
||||
|
||||
@@ -71,11 +71,11 @@ class KataEngine:
|
||||
def play(self, move):
|
||||
try:
|
||||
mr = self.board.play(move)
|
||||
move_id = mr.id
|
||||
except IllegalMoveException as e:
|
||||
print(str(e))
|
||||
self.controls.info.text = f"Illegal move: {str(e)}"
|
||||
return
|
||||
print("PLAYED",move,self.board.stones)
|
||||
self._request_analysis(mr)
|
||||
|
||||
def _request_analysis(self, move):
|
||||
@@ -116,8 +116,9 @@ class KataEngine:
|
||||
if self.controls.auto_undo.active(1 - self.current_player):
|
||||
undid = self._auto_undo(move)
|
||||
if self.controls.ai_auto.active and not undid:
|
||||
self._do_aimove(True)
|
||||
self._do_aimove(move,True)
|
||||
self.controls.undo.disabled = False
|
||||
self.controls.redraw()
|
||||
|
||||
def _evaluate_move(self, move, show=True):
|
||||
while not move.analysis:
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ class BadukPanWidget(Widget):
|
||||
xd, xp = self._find_closest(touch.x)
|
||||
yd, yp = self._find_closest(touch.y)
|
||||
prevghost = self.ghost_stone
|
||||
if self.engine.ready and max(yd, xd) < self.grid_size / 2 and (xp, yp) not in [(x, y) for _, x, y in self.engine.stones]:
|
||||
if self.engine.ready and max(yd, xd) < self.grid_size / 2 and (xp, yp) not in [m.coords for m in self.engine.stones]:
|
||||
self.ghost_stone = (xp, yp)
|
||||
else:
|
||||
self.ghost_stone = None
|
||||
|
||||
Reference in new issue
Block a user