Skip to content

Instantly share code, notes, and snippets.

@Krazete
Created February 12, 2021 22:09
Show Gist options
  • Save Krazete/5bc3e476bf87ed82beb3f6512a48560c to your computer and use it in GitHub Desktop.
Save Krazete/5bc3e476bf87ed82beb3f6512a48560c to your computer and use it in GitHub Desktop.
Automate the github.com/krazete/sandy web app.
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