Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "AI.h"
- #include <cassert>
- string getAIMoveString(const BuildingState& buildingState) {
- ** IAN
- // If any elevators are set to pick up, AND the elevators that is set to pick up is not currently servicing, do that (if multiple are set to pick up, pick up from the floor with the highest total anger level) After the pickup has been executed set the specific ElevatorPickup variable to false, return to the beginning of the loop.
- // if 0 true and 1 and 2 false just do 0
- // if 1 true and 0 and 2 false just do 1
- // if 2 true and 0 and 1 false just do 2
- // if 0 and 1 true and 2 false
- // check which has greater anger to its target do that
- // if 0 and 2 true and 1 false
- // check which has greater anger to its target do that
- // if 1 and 2 true and 0 false
- // check which has greater anger to its target do that
- // if 0 and 1 and 2 true
- // check which has greater anger to its target do that
- if (Elevator0PickUp && !buildingState.elevators[0].isServicing) {
- Elevator0PickUp = false;
- perform the pickup move that michael is writing
- }
- if (Elevator1PickUp) && !buildingState.elevators[1].isServicing{
- Elevator0PickUp = false;
- perform the pickup move that michael is writing
- }
- if (Elevator2PickUp) && !buildingState.elevators[2].isServicing{
- Elevator2PickUp = false;
- perform the pickup move that michael is writing
- }
- ** IAN
- ** NATE
- // If picking up just one person perform a normal pickup move
- // If picking up more than one person, find which direction everyone is going, then pick up the people with the highest combined anger level for that direction (if even, default to up)
- // go to next move
- ** NATE
- ** GRANT
- // Check Which Floor has the Highest Total Anger Level (as long as there isn’t an elevator currently going there - in this case, go to second highest/third highest etc.)
- ** GRANT
- ** IAN
- // Go through each elevator (for loop):
- ** IAN
- ** MICHAEL
- // If the elevator is already on the correct floor, perform the following:
- // If picking up just one person perform a normal pickup move
- // If picking up more than one person, find which direction everyone is going, then pick up the people with the highest combined anger level for that direction (if even, default to up)
- // Go to the next turn
- ** MICHEAL
- ** IAN
- // If that elevator is available to go the floor with the highest combined score of angry people (it’s not servicing) AND if there isn’t already an elevator going there then...
- if (!buildingState.elevators[i].isServicing && // EACH ELEVATORS TARGET FLOOR ISN'T EQUAL TO THE TARET FLOOR)
- if (i == 0) {
- Elevator0PickUp = true;
- }
- if (i == 1) {
- Elevator1PickUp = true;
- }
- if (i == 2) {
- Elevator2PickUp = true;
- }
- // Set a variable “Elevator0PickUp” / “Elevator1PickUp” or “Elevator2PickUp” to True (whichever it is)
- ** IAN
- ** NATE
- // Send the elevator to it and go to the next turn
- // If that elevator is not available (is servicing), go to the next elevator (repeat this loop (go through each elevator) from beginning)
- // If on the last elevator and it still isn’t available, perform a pass move
- ** NATE
- // Returns a string that represents the decision the AI makes
- // given the current state of the building, which it reads from
- // buildingState.
- // The string should share the exact format as a human player's move input.
- // Returning PASS move to prevent compilation error
- return "";
- }
- string getAIPickupList(const Move& move, const BuildingState& buildingState, const Floor& floorToPickup) {
- // Returns a string representing which people indices should be picked up
- // The string should share the exact format as a human player's pickup list input.
- return "";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement