diff --git a/src/diana/go.py b/src/diana/go.py --- a/src/diana/go.py +++ b/src/diana/go.py @@ -8,7 +8,8 @@ class Go: def __init__(self): self.board = [[EMPTY]*19 for i in range(19)] - self.moveCount = 0 + self.move_count = 0 + self.temp = [[]] def move(self, color, y, x): if self.board[x][y] != EMPTY: @@ -18,16 +19,16 @@ class Go: for i, j in ((-1, 0), (1, 0), (0, -1), (0, 1)): self.temp = [[False]*19 for i in range(19)] - if not self._floodFill(-color, x+i, y+j): + if not self._flood_fill(-color, x + i, y + j): self._remove() self.temp = [[False]*19 for i in range(19)] - if not self._floodFill(color, x, y): + if not self._flood_fill(color, x, y): self.board[x][y] = EMPTY return False - self.moveCount += 1 + self.move_count += 1 return True - def _floodFill(self, color, x, y): + def _flood_fill(self, color, x, y): if x < 0 or x > 18 or y < 0 or y > 18: return False if self.temp[x][y]: @@ -38,10 +39,10 @@ class Go: return False self.temp[x][y] = True - return self._floodFill(color, x-1, y) or \ - self._floodFill(color, x+1, y) or \ - self._floodFill(color, x, y-1) or \ - self._floodFill(color, x, y+1) + return self._flood_fill(color, x - 1, y) or \ + self._flood_fill(color, x + 1, y) or \ + self._flood_fill(color, x, y - 1) or \ + self._flood_fill(color, x, y + 1) def _remove(self): for i in range(19):