Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There 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.


Well if that was the case, then one result would always have 0. The indexes are used to find what something wins against




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: