aboutsummaryrefslogtreecommitdiff
path: root/2022/02/common.rs
blob: 04581cf478ce11d2fef62bb102377ca47c39eb53 (plain)
1
2
3
4
5
6
7
8
9
10
pub fn get_score(play_score: fn(&[u8]) -> i64, win_score: fn(&[u8]) -> i64) -> i64 {
    let mut score = 0;
    let mut line = String::new();
    while std::io::stdin().read_line(&mut line).unwrap() > 0 {
        let l = line.as_bytes();
        score += play_score(l) + win_score(l);
        line.clear();
    }
    score
}

Generated with cgit - Back to sebastiano.tronto.net