ErickDaGamer

Tynker: Counter Hack, solutions 17-20.

Sep 13th, 2020
1,245
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Level 17:
  2. while (!reachedGoal()) {
  3.     if (virusInSight()) {
  4.         fire();
  5.     } else if (hasPathAhead()) {
  6.         forward();
  7.     } else if (jumpableGapAhead()) {
  8.         longJump();
  9.     } else if ((!hasPathAhead())) {
  10.         turnLeft();
  11.     }
  12. }
  13.  
  14. Level 18:
  15. while (!reachedGoal()) {
  16.     if (virusInSight()) {
  17.         fire();
  18.     } else if (hasPathAhead()) {
  19.         forward();
  20.     } else if (hasPathLeft()) {
  21.         turnLeft();
  22.     } else if (!hasPathLeft()) {
  23.         turnRight();
  24.     }
  25. }
  26.  
  27. Level 19:
  28. while(!reachedGoal()) {
  29.     if(virusInSight()) {
  30.         fire();
  31.     }
  32.     if(hasPathAhead()) {
  33.         forward();
  34.     }
  35.     if(jumpableWallAhead()) {
  36.         highJump();
  37.     } else if (!hasPathAhead()){
  38.         turnLeft();
  39.     }
  40. }
  41.  
  42. Level 20:
  43. while(!reachedGoal()) {
  44.     if(virusInSight()) {
  45.         fire();
  46.     }
  47.     else if(hasPathAhead()) {
  48.         forward();
  49.     }
  50.     else if(jumpableGapAhead()) {
  51.         longJump();
  52.     }
  53.     else if (jumpableWallAhead()) {
  54.         highJump();
  55.     }
  56.     else if (hasPathRight()) {
  57.         turnRight();
  58.     }
  59.     else {
  60.         turnRight();
  61.     }
  62. }
  63.  
  64.  
  65. I might make this paste have all of the levels, but don't count on it.
RAW Paste Data