blob: 44ebe3a73b39fcfc817d39ed6c4862e88a366687 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
let rps_result = vec![4, 1, 7, 8, 5, 2, 3, 9 ,6];
fn main() {
let score = include_str!("../../example").lines().fold(0, parse_line);
}
fn parse_line(score: usize, line: &str) -> usize {
let mut moves = line.split(' ');
let opponent_move = moves.next().unwrap();
let my_move = moves.next().unwrap();
match opponent_move {
"A" => 1,
"B" => 2,
"C" => 3,
_ => unreachable!(),
};
0 + score
}
|