BXDGXGTY2UWJUOQK4W3DVAGABI5CGKAHR6OPBRLSS3U7XPO4CP5QC
var outcome: usize = undefined;
switch (me) {
1 => {
outcome = if (opp == 1) 3 else if (opp == 2) 0 else 6;
},
2 => {
outcome = if (opp == 1) 6 else if (opp == 2) 3 else 0;
},
3 => {
outcome = if (opp == 1) 0 else if (opp == 2) 6 else 3;
},
else => unreachable,
}
// https://learningpenguin.net/2020/02/06/a-simple-algorithm-for-calculating-the-result-of-rock-paper-scissors-game/
const outcome: usize = if (opp % 3 == me - 1) 6 else if (opp == me) 3 else 0;
var me: usize = undefined;
switch (outcome) {
0 => { // lose
me = if (opp == 1) 3 else if (opp == 2) 1 else 2;
},
3 => { // draw
me = if (opp == 1) 1 else if (opp == 2) 2 else 3;
},
6 => { // win
me = if (opp == 1) 2 else if (opp == 2) 3 else 1;
},
else => unreachable,
}
const me: usize = if (outcome == 6) (opp % 3) + 1 else if (outcome == 3) opp else ((opp + 1) % 3) + 1;