Created
February 12, 2021 22:09
-
-
Save Krazete/5bc3e476bf87ed82beb3f6512a48560c to your computer and use it in GitHub Desktop.
Automate the github.com/krazete/sandy web app.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function nextGame() { | |
setTimeout(changeMode, 1000); | |
setTimeout(startGame, 2000); | |
setTimeout(pair, 6250); | |
} | |
function pair() { | |
var currentMatches = matches; | |
for (var i = 0; i < currentBoard.size; i++) { | |
var pos = currentBoard.tilemap.indexOf(i); | |
if (currentBoard.livemap[pos]) { | |
selectTile(currentBoard.tileset[i]); | |
selectTile(currentBoard.tileset[i + currentBoard.size]); | |
} | |
if (matches > currentMatches) { | |
break; | |
} | |
} | |
if (matches == currentMatches) { | |
shuffleTiles(); | |
} | |
if (matches < currentBoard.size) { | |
setTimeout(pair, 250); | |
} | |
else { | |
nextGame(); | |
} | |
} | |
localStorage.clear(); | |
nextGame(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment