예제 #1
0
 def __init__(self, passengers: List[Person], maxFloor: int,
              capacity: int) -> None:
     self.passengers = passengers
     self.curFloor = 1
     self.maxFloor = maxFloor
     self.capacity = capacity
     self.passenNum = 0
     ElevatorSprite.__init__(self)
예제 #2
0
    def __init__(self, max_capacity: int) -> None:
        """Creates Elevator object with empty list of passengers and
        attributes inherited from superclass"""

        ElevatorSprite.__init__(self)
        self.passengers = []
        self.max_capacity = max_capacity
        self.floor = 1
예제 #3
0
 def __init__(self, capacity: int) \
         -> None:
     """
     Initialize a new elevator.
     """
     self.passengers = []
     self._capacity = capacity
     self.floor = 1
     ElevatorSprite.__init__(self)
예제 #4
0
    def __init__(self, capacity: int) -> None:
        """Initialize an elevator with its maximum capacity.

        Precondition: capacity >= 1
        """
        self.passengers = []
        self.max_capacity = capacity
        self.position = 1
        ElevatorSprite.__init__(self)
예제 #5
0
    def __init__(self, max_capacity: int) -> None:
        """
        Initialize a new elevator.

        Precondition: max_capacity >= 1
        """
        ElevatorSprite.__init__(self)
        self.max_capacity = max_capacity
        self.passengers = []
        self.current_floor = 1
예제 #6
0
    def __init__(self, capacity: int) -> None:
        """
        initialize a new elevator

        Preconditions:
            capacity>=1
        """
        ElevatorSprite.__init__(self)
        self.capacity = capacity
        self.passengers = []
        self.floor = 1
예제 #7
0
    def __init__(self, elevator_capacity: int) -> None:
        """Initialize a new Elevator

        Preconditions:
            maximum_capacity >= 1
            current_floor <= number of floors and current_floor >= 1
            current_capacity <= maximum_capacity and current_capacity >= 0
        """
        self.current_floor = 1
        self.maximum_capacity = elevator_capacity
        self.current_capacity = 0
        self.passengers = []
        ElevatorSprite.__init__(self)
예제 #8
0
    def show_disembarking(self, person: sprites.PersonSprite,
                          elevator: sprites.ElevatorSprite) -> None:
        """Show disembarking of the given person from the given elevator."""
        if not self._visualize:
            return

        from_x = person.rect.centerx
        target_x = 10

        elevator.update()

        for frame in range(21):  # Move in 20 seconds
            x = from_x + (target_x - from_x) * frame // 20
            person.rect.centerx = x
            self.render()
예제 #9
0
    def show_disembarking(self, person: sprites.PersonSprite,
                          elevator: sprites.ElevatorSprite) -> None:
        """Show disembarking of the given person from the given elevator."""
        if not self._visualize:
            return

        from_x = person.rect.centerx
        target_x = WIDTH - 10
        # print("dismbarking")
        # print("IN VISUALIZER FULLNESS:", elevator.fullness())
        elevator.update()

        for frame in range(21):  # Move in 20 seconds
            x = from_x + (target_x - from_x) * frame // 20
            person.rect.centerx = x
            self.render()
예제 #10
0
    def show_boarding(self, person: sprites.PersonSprite,
                      elevator: sprites.ElevatorSprite) -> None:
        """Show boarding of the given person onto the given elevator.

        Precondition: the given person is on the same floor as the elevator.
        """
        if not self._visualize:
            return

        from_x = 10
        target_x = elevator.rect.centerx + random.randint(-3, 3)

        for frame in range(21):  # Move in 20 seconds
            person.rect.centerx = from_x + (target_x - from_x) * frame // 20
            self.render()

        elevator.update()
        self.render()
예제 #11
0
 def __init__(self, capacity: int) -> None:
     ElevatorSprite.__init__(self)
     self.current_floor = 1
     self.max_capacity = capacity
     self.passengers = []
예제 #12
0
 def __init__(self, capacity: int) -> None:
     """Initialize a new Elevator."""
     self.passengers = []
     self.capacity = capacity
     self.location = 1
     ElevatorSprite.__init__(self)
예제 #13
0
 def __init__(self, passengers: List[Person], el_max: int) -> None:
     ElevatorSprite.__init__(self)
     self.current_floor = 1
     self.max_pass = el_max
     self.passengers = passengers