Yeah, I am not sure what is going on, I just played it 1000 times from rand and the results were.
500 plays - Player: 144, Computer: 179, Tie: 177
1000 plays - Player: 325, computer: 359, tie: 316
500 plays - Player: 144, Computer: 179, Tie: 177
1000 plays - Player: 325, computer: 359, tie: 316
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.
https://gist.github.com/mbrumlow/49f0a3fa311cc3002e4e1fae2e2...
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();
for(i=0; i<100; i++) { play(Math.floor(Math.random()*3)) }
Right in the JavaScript console.