From 0e6bebb63d5795ca9143b9713d1d82ebec8d7e03 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Fri, 27 Jun 2025 09:53:33 +0200 Subject: Day 10 --- 2022/10/common.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 2022/10/common.rs (limited to '2022/10/common.rs') diff --git a/2022/10/common.rs b/2022/10/common.rs new file mode 100644 index 0000000..c2216a0 --- /dev/null +++ b/2022/10/common.rs @@ -0,0 +1,13 @@ +pub enum Instruction { + Add(i64), + Noop +} + +pub fn read_instruction(line: &str) -> Instruction { + if &line[..4] == "addx" { + let n = line[5..line.len()-1].parse::().unwrap(); + Instruction::Add(n) + } else { + Instruction::Noop + } +} -- cgit v1.3