コード例 #1
0
ファイル: Braider.py プロジェクト: nathanmerrill/MazePython
 def get_neighbor_wrap(self, cell, direction):
     neighbor = list(Utils.add_tuples(cell.coordinates, direction.to_coordinates()))
     if neighbor[0] < 0:
         neighbor[0] += self.maze.width
     elif neighbor[0] >= self.maze.width:
         neighbor[0] -= self.maze.width
     if neighbor[1] < 0:
         neighbor[1] += self.maze.height
     elif neighbor[1] >= self.maze.height:
         neighbor[1] -= self.maze.height
     return self.maze.get(tuple(neighbor))
コード例 #2
0
ファイル: Cell.py プロジェクト: nathanmerrill/MazePython
 def get_neighbor(self, direction):
     return self.grid.get(Utils.add_tuples(self.coordinates, direction.to_coordinates()))