floor module#

class floor.ButtonPressed#

Bases: object

Represents a class that contains information about the buttons pressed on a floor

Parameters:
  • move_up (bool) – Whether the move up button is pressed

  • move_down (bool) – Whether the move down button is pressed

  • last_pressed_up (int) – The last time the move up button was pressed

  • last_pressed_down (int) – The last time the move down button was pressed

set_move_down(value, time)#

Set the move down button to the given value and update the last pressed time

Parameters:
  • value (bool) – The value to set the button to

  • time (int) – The current time

set_move_up(value, time)#

Set the move up button to the given value and update the last pressed time

Parameters:
  • value (bool) – The value to set the button to

  • time (int) – The current time

update_time(direction, time)#
class floor.Floor(number)#

Bases: object

Represents a floor in the building

Parameters:
  • number (int) – The number of the floor

  • passenger_list (list) – The list of passengers on the floor

  • button_pressed (ButtonPressed) – The buttons pressed on the floor

remove_passenger(passenger, time)#

Removes a passenger from the floor and updates the floor buttons

Parameters:
  • passenger (Passenger) – The passenger to remove

  • time (int) – The current time

spawn_passenger(passenger, time)#

Adds a passenger to the floor and updates the floor buttons

Parameters:
  • passenger (Passenger) – The passenger to add

  • time (int) – The current time

update_floor_buttons(time)#

Updates the floor buttons based on the passengers on the floor

Parameters:

time (int) – The current time