Last active
July 20, 2017 19:41
-
-
Save rosenpin/340a7b77c2ae8bf221c733f644840a07 to your computer and use it in GitHub Desktop.
Math Battle Bot For Telegram
This file contains 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
var index = 0 | |
var reps = 77 | |
function run(){ | |
if(index < reps){ | |
setTimeout(function(){ | |
var operator = {"+" : "+", "–" : "-", "×" : "*", "/" : "/"}[document.getElementById("task_op").innerText] | |
var x = document.getElementById("task_x").innerText | |
var y = document.getElementById("task_y").innerText | |
var solution = document.getElementById("task_res").innerText | |
var w_button = document.getElementById("button_wrong") | |
var v_button = document.getElementById("button_correct") | |
if(eval(x + operator + y) == solution) v_button.click() | |
else w_button.click() | |
run() | |
},400) | |
} | |
index++ | |
} | |
run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment