Advertisement
Guest User

ian's portion

a guest
Dec 9th, 2019
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.25 KB | None | 0 0
  1. #include "AI.h"
  2. #include <cassert>
  3.  
  4. string getAIMoveString(const BuildingState& buildingState) {
  5.  
  6.  
  7. ** IAN
  8. // 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.
  9. // if 0 true and 1 and 2 false just do 0
  10. // if 1 true and 0 and 2 false just do 1
  11. // if 2 true and 0 and 1 false just do 2
  12. // if 0 and 1 true and 2 false
  13. // check which has greater anger to its target do that
  14. // if 0 and 2 true and 1 false
  15. // check which has greater anger to its target do that
  16. // if 1 and 2 true and 0 false
  17. // check which has greater anger to its target do that
  18. // if 0 and 1 and 2 true
  19. // check which has greater anger to its target do that
  20. if (Elevator0PickUp && !buildingState.elevators[0].isServicing) {
  21. Elevator0PickUp = false;
  22. perform the pickup move that michael is writing
  23. }
  24. if (Elevator1PickUp) && !buildingState.elevators[1].isServicing{
  25. Elevator0PickUp = false;
  26. perform the pickup move that michael is writing
  27. }
  28. if (Elevator2PickUp) && !buildingState.elevators[2].isServicing{
  29. Elevator2PickUp = false;
  30. perform the pickup move that michael is writing
  31. }
  32.  
  33. ** IAN
  34.  
  35. ** NATE
  36. // If picking up just one person perform a normal pickup move
  37. // 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)
  38. // go to next move
  39. ** NATE
  40.  
  41. ** GRANT
  42. // 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.)
  43. ** GRANT
  44.  
  45. ** IAN
  46. // Go through each elevator (for loop):
  47. ** IAN
  48.  
  49. ** MICHAEL
  50. // If the elevator is already on the correct floor, perform the following:
  51.  
  52. // If picking up just one person perform a normal pickup move
  53. // 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)
  54.  
  55. // Go to the next turn
  56. ** MICHEAL
  57.  
  58. ** IAN
  59. // 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...
  60. if (!buildingState.elevators[i].isServicing && // EACH ELEVATORS TARGET FLOOR ISN'T EQUAL TO THE TARET FLOOR)
  61. if (i == 0) {
  62. Elevator0PickUp = true;
  63. }
  64. if (i == 1) {
  65. Elevator1PickUp = true;
  66. }
  67. if (i == 2) {
  68. Elevator2PickUp = true;
  69. }
  70.  
  71. // Set a variable “Elevator0PickUp” / “Elevator1PickUp” or “Elevator2PickUp” to True (whichever it is)
  72. ** IAN
  73.  
  74. ** NATE
  75. // Send the elevator to it and go to the next turn
  76.  
  77.  
  78. // If that elevator is not available (is servicing), go to the next elevator (repeat this loop (go through each elevator) from beginning)
  79.  
  80. // If on the last elevator and it still isn’t available, perform a pass move
  81. ** NATE
  82.  
  83.  
  84.  
  85.  
  86. // Returns a string that represents the decision the AI makes
  87. // given the current state of the building, which it reads from
  88. // buildingState.
  89. // The string should share the exact format as a human player's move input.
  90.  
  91. // Returning PASS move to prevent compilation error
  92. return "";
  93. }
  94.  
  95. string getAIPickupList(const Move& move, const BuildingState& buildingState, const Floor& floorToPickup) {
  96. // Returns a string representing which people indices should be picked up
  97. // The string should share the exact format as a human player's pickup list input.
  98.  
  99. return "";
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement