aboutsummaryrefslogtreecommitdiff
path: root/2022/02/a.rs
blob: 1a49a6b7c0aba2791b33455c7a4d7015cb642eaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
mod common;
use common::*;

pub fn main() {
    let play_score = |s: &[u8]| (s[2] as i64) - ('X' as i64) + 1;
    let win_score = |s: &[u8]| {
        let other = s[0] as i64 - ('A' as i64);
        let me = s[2] as i64 - ('X' as i64);
        3 * ((me - other + 4) % 3)
    };
    let score = get_score(play_score, win_score);
    println!("{score}");
}

Generated with cgit - Back to sebastiano.tronto.net