Skip to content

Instantly share code, notes, and snippets.

@faller222
Created April 20, 2020 01:34
Show Gist options
  • Save faller222/f25ee2b92973a4dc86b7c4539228e44a to your computer and use it in GitHub Desktop.
Save faller222/f25ee2b92973a4dc86b7c4539228e44a to your computer and use it in GitHub Desktop.
var time =5
function part2(map, boxes){
if($("div.second").length>=25){
for(var i=0;i<25;i++){
var b = boxes[i];
var pos = parseInt(b.innerText);
map[pos]=b;
}
for(var i=26;i<51;i++){
$(map[i]).trigger("tap");
}
}
}
function part1(time){
var grid = $(".grid.x5").get(0);
var map={};
var boxes = grid.getElementsByTagName("div")
for(var i=0;i<25;i++){
var b = boxes[i];
var pos = parseInt(b.innerText);
map[pos]=b;
}
for(var i=1;i<26;i++){
$(map[i]).trigger("tap");
}
setInterval( part2, time,map,boxes)
}
part1(time);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment