summaryrefslogtreecommitdiffstats
path: root/2022/day2/part1/src/main.rs
diff options
context:
space:
mode:
authorYigit Sever2022-12-02 20:54:14 +0300
committerYigit Sever2022-12-02 20:54:14 +0300
commit1a844dd44f8f9a457dcbcdbf5cfdb7e3b73f8358 (patch)
tree16309d21cfa4461acbe599018a42644b65c4ac14 /2022/day2/part1/src/main.rs
parentdcb1c08422a46f1f43d7002a3d4790b713dd9eab (diff)
downloadaoc-1a844dd44f8f9a457dcbcdbf5cfdb7e3b73f8358.tar.gz
aoc-1a844dd44f8f9a457dcbcdbf5cfdb7e3b73f8358.tar.bz2
aoc-1a844dd44f8f9a457dcbcdbf5cfdb7e3b73f8358.zip
2022, day2: continue at home
Diffstat (limited to '2022/day2/part1/src/main.rs')
-rw-r--r--2022/day2/part1/src/main.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/2022/day2/part1/src/main.rs b/2022/day2/part1/src/main.rs
new file mode 100644
index 0000000..44ebe3a
--- /dev/null
+++ b/2022/day2/part1/src/main.rs
@@ -0,0 +1,21 @@
1let rps_result = vec![4, 1, 7, 8, 5, 2, 3, 9 ,6];
2
3
4fn main() {
5 let score = include_str!("../../example").lines().fold(0, parse_line);
6}
7
8fn parse_line(score: usize, line: &str) -> usize {
9 let mut moves = line.split(' ');
10 let opponent_move = moves.next().unwrap();
11 let my_move = moves.next().unwrap();
12
13 match opponent_move {
14 "A" => 1,
15 "B" => 2,
16 "C" => 3,
17 _ => unreachable!(),
18 };
19
20 0 + score
21}