diff --git a/src/diana/go.py b/src/diana/go.py --- a/src/diana/go.py +++ b/src/diana/go.py @@ -12,6 +12,12 @@ class Go: self.temp = [[]] def move(self, color, y, x): + """Update the board with the specified move. + + :param int color: BLACK or WHITE + :param int y: the row number + :param int x: the column number + :return: True on success, False on an invalid move""" if self.board[x][y] != EMPTY: return False @@ -39,10 +45,10 @@ class Go: return False self.temp[x][y] = True - 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) + 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):