from src.obj.Object import Object class Table(Object): def __init__(self, position, orientation, square_size, square_count, current_role=1): super().__init__("table", position, orientation, square_size, square_count) self.roles = ["table", "order", "wait", "done"] self.current_role = current_role self.change_role(self.roles[self.current_role]) def next_role(self, waiter): if waiter.agent_role == "waiter": self.current_role = (self.current_role + 1) % 4 self.change_role(self.roles[self.current_role]) def goal_test(self, waiter) -> bool: if self.position == waiter.position: if self.agent_role == "order": return waiter.take_order(self) elif self.agent_role == "done": return waiter.drop_order(self) return False