Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var stepCount;
  2. var highestStep = 0;
  3. var tries = 0;
  4.  
  5. var steps = document.getElementsByClassName("style__step___MFw_G");
  6.  
  7. function start() {
  8.   tries++;
  9.   stepCount = 1;
  10.   document.getElementsByTagName("button")[31].click();
  11. }
  12.  
  13. function randomTile() {
  14.   steps[steps.length - stepCount].children[getRandom() - 1].click();
  15.   stepCount++;
  16. }
  17.  
  18. function isDead() {
  19.   if (document.getElementsByClassName("style__demoModeVisible___16rat")[0]) {
  20.     return false;
  21.   } else {
  22.     return true;
  23.   }
  24. }
  25.  
  26. function getRandom() {
  27.   return Math.floor((Math.random() * 3) + 1);
  28. }
  29.  
  30. start();
  31.  
  32. function run() {
  33.   if (stepCount == 10) {stop();}
  34.   stats();
  35.   if (!isDead()) {
  36.    randomTile();
  37.  } else {
  38.    start();
  39.  }
  40. }
  41.  
  42. function stop() {
  43.   clearInterval(t);
  44. }
  45.  
  46. function stats() {
  47.   if (stepCount > highestStep) {
  48.     highestStep = stepCount;
  49.   }
  50.   console.clear();
  51.   console.log("|" + tries + "| Highscore: " + highestStep + " | Money wasted: $" + tries * 1.99);
  52. }
  53.  
  54. var t = setInterval(run, 1500);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement