def init_seats(self):
raise NotImplementedError("Vehicles should specify a list of seats")
- def assign_seats(self, seating):
- for roach_name, seat in zip(seating, self.seats):
- seat.roach = roach_name
+ def seating(self, world):
+ roach_seating = world.vehicles[self.vehicle_type].seating
+ roach_seating_numbers = enumerate(zip(roach_seating, self.seats))
+ return {
+ roach: seat_pos
+ for seat_pos, (roach, _) in roach_seating_numbers if roach
+ }
_vehicle_types = {}
@classmethod
def current(cls, world):
- vehicle = cls.by_type(world.vehicles.current)
- vehicle.assign_seats(
- world.vehicles[vehicle.vehicle_type].seating)
- return vehicle
+ return cls.by_type(world.vehicles.current)
@classmethod
def by_type(cls, vehicle_type):