// Assigns a column and elevator to use when making a request from RC via the board buttons
        public void AssignElevator(int requestedFloor)
        {
            var      boardBtnToPress = BoardButtonList.Find(btn => btn.RequestedFloor == requestedFloor);
            Elevator chosenElevator  = boardBtnToPress.Press();

            // Do requests until elevator has reached the floor where the call was made (RC floor)
            while (chosenElevator.CurrentFloor != Elevator.OriginFloor)
            {
                chosenElevator.DoRequests();
            }

            // Set a request for the elevator to go to requested floor, once picked up
            string newDirection = (chosenElevator.CurrentFloor < requestedFloor) ? "up" : "down";

            chosenElevator.SendRequest(requestedFloor, newDirection);

            // Do requests until elevator has reached requested floor
            while (chosenElevator.CurrentFloor != requestedFloor)
            {
                chosenElevator.DoRequests();
            }
        }
        // Choose which elevator should be called from the chosen column
        public Elevator ChooseElevator()
        {
            List <int> elevatorScores = new List <int>();
            var        chosenColumn   = ChooseColumn();

            foreach (var elevator in chosenColumn.ElevatorList)
            {
                // Initialize score to 0
                int score = 0;

                // Calculate floor difference differently based on whether or not elevator is already at RC or not
                // Remember: Each column has a floor range that its elevators must respect. The RC is not included in the range, so to make the calculations fair, if elevator is already at RC the floor difference will still look normal thanks to the 2nd calculation option as it will start from the column's lowest floor instead of at RC.
                int floorDifference;

                if (elevator.CurrentFloor != Elevator.OriginFloor)
                {
                    floorDifference = elevator.CurrentFloor - chosenColumn.LowestFloor;
                }
                else
                {
                    floorDifference = 0;
                }

                // Prevents use of any offline/under-maintenance elevators
                if (elevator.Status != "online")
                {
                    score = -1;
                }
                else
                {
                    // Bonify score based on floor difference
                    if (floorDifference == 0)
                    {
                        score += 5000;
                    }
                    else
                    {
                        score += 5000 / (Math.Abs(floorDifference) + 1);
                    }

                    // Bonify score based on direction (highest priority)
                    if (elevator.Movement != "idle")
                    {
                        if (floorDifference < 0 && Direction == "down" && elevator.Movement == "down")
                        {
                            // Paths are not crossed, therefore try avoiding the use of this elevator
                            score = 0;
                        }
                        else if (floorDifference > 0 && Direction == "up" && elevator.Movement == "up")
                        {
                            // Paths are not crossed, therefore try avoiding the use of this elevator
                            score = 0;
                        }
                        else
                        {
                            // Paths are crossed, therefore favor this elevator
                            score += 1000;

                            // Calculate next floor difference differently based on whether or not elevator's next floor will be at RC or not
                            int nextFloorDifference;
                            if (elevator.NextFloor != Elevator.OriginFloor)
                            {
                                nextFloorDifference = elevator.NextFloor - chosenColumn.LowestFloor;
                            }
                            else
                            {
                                nextFloorDifference = 0;
                            }

                            // Give redemption points, in worst case scenario where all elevators never cross paths
                            if (nextFloorDifference == 0)
                            {
                                score += 500;
                            }
                            else
                            {
                                score += 500 / (Math.Abs(nextFloorDifference) + 1);
                            }
                        }
                    }

                    // Bonify score on request queue size (the smaller number of pre-existing requests, the faster therefore the better)
                    if (elevator.RequestsQueue.Count <= 3)
                    {
                        score += 1000;
                    }
                    else if (elevator.RequestsQueue.Count <= 7)
                    {
                        score += 250;
                    }
                }
                // Send total score of elevator to the scores list
                elevatorScores.Add(score);
            }

            // Get value of highest score
            int highestScore = -1;

            foreach (int score in elevatorScores)
            {
                if (score > highestScore)
                {
                    highestScore = score;
                }
            }

            // Get the elevator with the highest score (or NULL if all elevators were offline)
            Elevator chosenElevator = null;

            if (highestScore > -1)
            {
                int index = elevatorScores.FindIndex(score => score == highestScore);
                chosenElevator = chosenColumn.ElevatorList[index];

                WriteLine($"Chosen elevator of Column {chosenColumn.ID}: Elevator {chosenElevator.ID}\n");
            }
            return(chosenElevator);
        }
 public FloorDisplay(Elevator elevator_)
 {
     _elevator = elevator_;
 }