From 1a844dd44f8f9a457dcbcdbf5cfdb7e3b73f8358 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Fri, 2 Dec 2022 20:54:14 +0300 Subject: 2022, day2: continue at home --- 2022/day2/part1/src/main.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 2022/day2/part1/src/main.rs (limited to '2022/day2/part1/src/main.rs') 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 @@ +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 +} -- cgit v1.2.3-70-g09d2