I wanted to create a rock-paper-scissors game that didn't use a lot of conditionals, and I was wondering if there were any mathematical way of representing the cycle of rock-paper-scissors. So Rock beats Paper beats Scissors beats Rock, or Rock > Paper > Scissors > Rock. If you assigned numbers to these, it wouldn't work: 0 > 1 > 2 > 0. But I was wondering if there were some way you could use modulus function to make this work? I understand that if you had a series of integers and modded them by 3 you would get a repeating cycle of 0, 1, 2, e.g. 60 % 3 = 0; 61 % 3 = 1; 62 % 3 = 2, 63 % 3 = 0, etc.
Do you think there could be any way to make this programmable using mods? I'm interested to know if there's an algorithm or some way to use this to create a cycle where 0>1>2>0. Just a warning, though, I don't study maths or know a lot about complex maths, so if you know of a way to do this, I'd really appreciate it if you tried not to overwhelm me with maths terms!
<really makes sense when using modulus... – long tom May 14 '13 at 08:252+1=0 (mod 3), so2beats0? – long tom May 14 '13 at 08:26