+ def addMove(self, m):
+ """Add move to the board."""
+ self.stones[(m.y * self.size) + m.x] = m.color
+
+ def getMoveCandidates(self, board):
+ """Take the next board in game and return a list of moves that are
+ new."""
+ candidates = []
+ for i in range(self.size):
+ for j in range(self.size):
+ if (self.stones[self.size * i + j] == "."):
+ if (board.stones[self.size * i + j] == "W"):
+ candidates.append(Move("W", i, j))
+ elif (board.stones[self.size * i + j] == "B"):
+ candidates.append(Move("B", i, j))
+ return candidates
+
+class Move:
+ """Repsresents a move."""
+ def __init__(self, color, y, x, comment=None):
+ self.color = color
+ self.x = x
+ self.y = y
+ self.comment = comment
+
+ def sgf_coords(self):
+ """Return coordinates of the move in SGF."""
+ return COORDS[self.x] + COORDS[self.y]
+