Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var stepCount;
- var highestStep = 0;
- var tries = 0;
- var steps = document.getElementsByClassName("style__step___MFw_G");
- function start() {
- tries++;
- stepCount = 1;
- document.getElementsByTagName("button")[31].click();
- }
- function randomTile() {
- steps[steps.length - stepCount].children[getRandom() - 1].click();
- stepCount++;
- }
- function isDead() {
- if (document.getElementsByClassName("style__demoModeVisible___16rat")[0]) {
- return false;
- } else {
- return true;
- }
- }
- function getRandom() {
- return Math.floor((Math.random() * 3) + 1);
- }
- start();
- function run() {
- if (stepCount == 10) {stop();}
- stats();
- if (!isDead()) {
- randomTile();
- } else {
- start();
- }
- }
- function stop() {
- clearInterval(t);
- }
- function stats() {
- if (stepCount > highestStep) {
- highestStep = stepCount;
- }
- console.clear();
- console.log("|" + tries + "| Highscore: " + highestStep + " | Money wasted: $" + tries * 1.99);
- }
- var t = setInterval(run, 1500);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement