Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. for (int i = 0; i < 3; i++) {
  2. if (buildingState.elevators[i] == grantFloor) {
  3. if (grantFloor.numpeople == 1) {
  4. string elevator = "e";
  5. string elevatornum = isdigit(i); // FIXME convert int --> string
  6. string pickup = "p";
  7. string elevatornumber = elevator.append(elevatornum);
  8. string pickupmove = elevatornumber.append(pickup);
  9.  
  10. return pickupmove;
  11. }
  12.  
  13. if (grantFloor.numpeople > 1) {
  14. Move pickupmove;
  15. return getAIPickupList(pickupmove, BuildingState, grantFloor);
  16. }
  17. }
  18. }
  19.  
  20.  
  21.  
  22.  
  23. string getAIPickupList(const Move& move, const BuildingState& buildingState, const Floor& floorToPickup) {
  24.  
  25. int angerup;
  26. int angerdown;
  27. for (int j = 0; 0 < grantFloor.numpeople; j++){
  28. if (grantFloor.floornum < grantFloor.targetFloor) {
  29. angerup += grantFloor.people[j].angerlevel;
  30. }
  31. if (grantFloor.floornum > grantFloor.targetFloor) {
  32. angerdown += grantFloor.people[j].angerlevel;
  33. }
  34. }
  35. if (angerup > angerdown) {
  36. string elevator = "e";
  37. string elevatornum = isdigit(i); // FIXME convert int --> string
  38. string pickup = "p";
  39. string elevatornumber = elevator.append(elevatornum);
  40. string pickupmove = elevatornumber.append(pickup);
  41.  
  42. return pickupmove;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement