Re:Show HN: Play rock paper and scissors against a untrained...
by camjohnson26 on Friday July 26, 2019 @01:18AM
(#20532538)
I just did the same thing,
500 plays - Player: 163, Computer: 179, Tie: 158
1000 plays - Player: 306, Computer: 365, Tie: 329
I've run it several times and the computer has won every time against random, it must have an unfair advantage.
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?
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();
500 plays - Player: 144, Computer: 179, Tie: 177
https://youtu.be/g9Zo771HYpM
1000 plays - Player: 325, computer: 359, tie: 316
https://youtu.be/7pB5TZ_xYzE