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
|
@property
|
||||||
def stones(self):
|
def stones(self):
|
||||||
return self.engine.stones
|
return self.engine.board.stones
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def moves(self):
|
def moves(self):
|
||||||
|
|||||||
@@ -71,11 +71,11 @@ class KataEngine:
|
|||||||
def play(self, move):
|
def play(self, move):
|
||||||
try:
|
try:
|
||||||
mr = self.board.play(move)
|
mr = self.board.play(move)
|
||||||
move_id = mr.id
|
|
||||||
except IllegalMoveException as e:
|
except IllegalMoveException as e:
|
||||||
print(str(e))
|
print(str(e))
|
||||||
self.controls.info.text = f"Illegal move: {str(e)}"
|
self.controls.info.text = f"Illegal move: {str(e)}"
|
||||||
return
|
return
|
||||||
|
print("PLAYED",move,self.board.stones)
|
||||||
self._request_analysis(mr)
|
self._request_analysis(mr)
|
||||||
|
|
||||||
def _request_analysis(self, move):
|
def _request_analysis(self, move):
|
||||||
@@ -116,8 +116,9 @@ class KataEngine:
|
|||||||
if self.controls.auto_undo.active(1 - self.current_player):
|
if self.controls.auto_undo.active(1 - self.current_player):
|
||||||
undid = self._auto_undo(move)
|
undid = self._auto_undo(move)
|
||||||
if self.controls.ai_auto.active and not undid:
|
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.undo.disabled = False
|
||||||
|
self.controls.redraw()
|
||||||
|
|
||||||
def _evaluate_move(self, move, show=True):
|
def _evaluate_move(self, move, show=True):
|
||||||
while not move.analysis:
|
while not move.analysis:
|
||||||
|
|||||||
+1
-1
@@ -37,7 +37,7 @@ class BadukPanWidget(Widget):
|
|||||||
xd, xp = self._find_closest(touch.x)
|
xd, xp = self._find_closest(touch.x)
|
||||||
yd, yp = self._find_closest(touch.y)
|
yd, yp = self._find_closest(touch.y)
|
||||||
prevghost = self.ghost_stone
|
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)
|
self.ghost_stone = (xp, yp)
|
||||||
else:
|
else:
|
||||||
self.ghost_stone = None
|
self.ghost_stone = None
|
||||||
|
|||||||
Reference in new issue
Block a user