Skip to content

Instantly share code, notes, and snippets.

@romainberger
Created March 4, 2015 11:58
Show Gist options
  • Save romainberger/b08d1e5ae09f33ee3598 to your computer and use it in GitHub Desktop.
Save romainberger/b08d1e5ae09f33ee3598 to your computer and use it in GitHub Desktop.
Javascript cheat for http://colorrun.pl
var c1 = $('#color-1'),
c2 = $('#color-2')
setInterval(function() {
var co1 = c1.css('background-color').replace('rgb(', '').replace(')', '').split(', '),
co2 = c2.css('background-color').replace('rgb(', '').replace(')', '').split(', ')
t1 = 0,
t2 = 0
co1.forEach(function(x) {
t1 += parseInt(x, 10)
})
co2.forEach(function(x) {
t2 += parseInt(x, 10)
})
if (t1 < t2) {
c2.click()
}
else {
c1.click()
}
}, 100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment