Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int sourceHt = 0;
- int clearence = 0;
- int targetDrop = 3;
- int maxObstacleHt = 0;
- int currentBar = 0;
- for (int i = 0; i < blockHeights.length; i++) {
- sourceHt += blockHeights[i];
- }
- for (int i = 0; i < barHeights.length; i++) {
- if (barHeights[i] > maxObstacleHt) {
- maxObstacleHt = barHeights[i];
- }
- }
- clearence = sourceHt;
- //Raise
- while (h < clearence + 1) {
- r.up();
- h++;
- }
- for (int i = blockHeights.length - 1; i >= 0; i--) {
- //Raise
- while (d > clearence - (maxObstacleHt + blockHeights[i])) {
- r.raise();
- d--;
- }
- //Extend
- while (w < 10) {
- r.extend();
- w++;
- }
- //Lower
- while (h - d > sourceHt + 1) {
- r.lower();
- d++;
- }
- r.pick();
- sourceHt -= blockHeights[i];
- //Raise
- while (d > clearence - (maxObstacleHt + blockHeights[i])) {
- r.raise();
- d--;
- }
- //Contract
- while (w > targetDrop) {
- r.contract();
- w--;
- }
- if (blockHeights[i] == 3) {
- currentBar = targetDrop - 3;
- targetDrop += 1;
- }
- //Lower
- while (h - d > barHeights[currentBar] + blockHeights[i] + 1) {
- r.lower();
- d++;
- }
- r.drop();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement