Re:Show HN: Play rock paper and scissors against a untrained...
by albertshin on Thursday July 25, 2019 @11:33PM
(#20532153)
How are you emulating the clicking?
[ Parent
| on HN ]
Re:Show HN: Play rock paper and scissors against a untrained...
by mbrumlow on Thursday July 25, 2019 @11:45PM
(#20532204)
I normally write a c program or go linked to xlib to do this sort of work, but I just used xdotool in a bash script for this.
https://gist.github.com/mbrumlow/49f0a3fa311cc3002e4e1fae2e2...
Re:Show HN: Play rock paper and scissors against a untrained...
by albertshin on Sunday July 28, 2019 @03:49AM
(#20546341)
thanks! didn't know about xdotool
Re:Show HN: Play rock paper and scissors against a untrained...
by kojackst on Thursday July 25, 2019 @11:47PM
(#20532207)
This runs it randomly 1000 times (well not reaaally randomly, but it gets close), just paste it into the browser console:
const times = 1000;
function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
async function run() { for (let i = 0; i < times; i++) { await sleep(10); play(Math.floor(Math.random()*3)); } }
run();