Lurker News

Comments (491) 209 threads

Show all comments

Showing thread 152 of 209

busterarm#
Rock, Scissors, Paper in a circular array.

All you have to do to test for win condition is check if the other player has the next item in the array.
Equality is a tie.
Base case is a loss.
It's also my favorite case of structuring data in a way that makes the algorithm self-evident.