Implement 5s rule for seating.
[koperkapel.git] / koperkapel / vehicles / base.py
index fb4640dd73be2a47e217bd0c1f66ac27565188ec..f4506d602bfb520c0235ef9b4ac23f6cb475671a 100644 (file)
@@ -18,8 +18,20 @@ class Vehicle:
     def init_seats(self):
         raise NotImplementedError("Vehicles should specify a list of seats")
 
+    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):
+        return cls.by_type(world.vehicles.current)
+
     @classmethod
     def by_type(cls, vehicle_type):
         return cls._vehicle_types.get(vehicle_type)()