Advertisement
Guest User

Untitled

a guest
Jul 29th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. int sourceHt = 0;
  2. int clearence = 0;
  3. int targetDrop = 3;
  4. int maxObstacleHt = 0;
  5. int currentBar = 0;
  6.  
  7.  
  8.  
  9. for (int i = 0; i < blockHeights.length; i++) {
  10. sourceHt += blockHeights[i];
  11. }
  12.  
  13. for (int i = 0; i < barHeights.length; i++) {
  14. if (barHeights[i] > maxObstacleHt) {
  15. maxObstacleHt = barHeights[i];
  16. }
  17. }
  18.  
  19. clearence = sourceHt;
  20.  
  21. //Raise
  22. while (h < clearence + 1) {
  23. r.up();
  24. h++;
  25. }
  26.  
  27. for (int i = blockHeights.length - 1; i >= 0; i--) {
  28. //Raise
  29. while (d > clearence - (maxObstacleHt + blockHeights[i])) {
  30. r.raise();
  31. d--;
  32. }
  33.  
  34.  
  35.  
  36. //Extend
  37. while (w < 10) {
  38. r.extend();
  39. w++;
  40. }
  41.  
  42. //Lower
  43. while (h - d > sourceHt + 1) {
  44. r.lower();
  45. d++;
  46. }
  47.  
  48. r.pick();
  49.  
  50. sourceHt -= blockHeights[i];
  51.  
  52. //Raise
  53. while (d > clearence - (maxObstacleHt + blockHeights[i])) {
  54. r.raise();
  55. d--;
  56. }
  57.  
  58. //Contract
  59. while (w > targetDrop) {
  60. r.contract();
  61. w--;
  62. }
  63.  
  64. if (blockHeights[i] == 3) {
  65. currentBar = targetDrop - 3;
  66. targetDrop += 1;
  67. }
  68.  
  69.  
  70. //Lower
  71. while (h - d > barHeights[currentBar] + blockHeights[i] + 1) {
  72. r.lower();
  73. d++;
  74. }
  75. r.drop();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement