def generate_children(self, node): children = [] for move in MOVES: temp = copy.deepcopy(node) temp.board = MOVE(node.board, move) if valid_move(): children.append(temp) temp.ai_move = move return children
def has_lost(self): full_board = True for row in self.board: for tile in row: if tile == EMPTY: return False for move in MOVES: temp = MOVE(self.board, move) if valid_move(): return False return True
def move(self, move): self.board = MOVE(self.board, move) self.valid_move = valid_move()