Пример #1
0
 def add_road(self, goal_intersection, direction: Direction):
     """
     Add an outgoing lane to goal_intersection, which is at direction
     """
     road = Road(self, goal_intersection, direction.opposite())
     self.outgoing_roads[direction] = road
     goal_intersection.incoming_roads[direction.opposite()] = road
Пример #2
0
 def _construct_road_row(self, row_index: int) -> List[Road]:
     switcher = {
         0: 2 * self.width,
         1: self.width + 1,
         2: 2 * self.width,
         3: self.width
     }
     return [Road() for i in range(switcher[row_index % 4])]