4 ms·
Is it actually a 1/3 chance of winning though? Is that including a draw as a win? I've tried coding it up here: https://gist.github.com/andyhmltn/5c8c5734fe89
by andyhmltn 12y ago
Is it actually a 1/3 chance of winning though? Is that including a draw as a win?
I've tried coding it up here:
https://gist.github.com/andyhmltn/5c8c5734fe894db5aa02 https://gist.github.com/andyhmltn/5c8c5734fe894db5aa02
Baring in mind it was a rushed 5 minute bodge-job so it could be wrong but there seems to be a massive skew towards draws
After more tests with this code it seems there's an 11% chance of winning if it's random. Baring in mind javascripts RNG
- Monkeyget 12y agoThere is an equiprobability of winning/losing/draw. Your code is erroneous. You do a +1 to the random number you generate giving you 1, 2, 3. You then use that number to access an array with indexes [0, 1, 2]. You end with an undefined which screws your results.
- andyhmltn 12y agoWell if that was the case, then one result would always have 0. The indexes are used to find what something wins against