예제 #1
0
 def successors(self, vertical):
     for row in range(self.row):
         for col in range(self.column):
             copy = self.copy()
             if self.is_legal_move(row, col, vertical):
                 copy.perform_move(row, col, vertical)
                 yield (row, col), copy
예제 #2
0
 def successors(self):
     for direction in [
             "up", "down", "left", "right", "up-left", "up-right",
             "down-left", "down-right"
     ]:
         copy = self.copy()
         if copy.perform_move(direction):
             yield tuple(copy.start_location), copy
예제 #3
0
파일: driver.py 프로젝트: bwaldt/EightGame
 def successors(self):
     moves = ["up", "down", "right", "left"]
     succesors = []
     for direction in moves:
         copy = self.copy()
         is_possible = copy.perform_move(direction)
         if is_possible:
             succesors.append((direction, copy))
     return succesors
예제 #4
0
 def successors(self):
     all_successors = []
     moves = ["up", "down", "left", "right"]  #Possible moves
     for direction in moves:
         copy = self.copy()
         is_possible = copy.perform_move(
             direction)  #Checks if the move is possible
         if is_possible:
             all_successors.append((direction, copy))
     return all_successors
예제 #5
0
 def successors(self):
     for direction in ["up", "down", "left", "right"]:
         copy = self.copy()
         if copy.perform_move(direction):
             yield direction, copy