aoc

My solutions for the Advent of Code
git clone https://git.tronto.net/aoc
Download | Log | Files | Refs | README

common.rs (270B)


      1 pub enum Instruction {
      2     Add(i64),
      3     Noop
      4 }
      5 
      6 pub fn read_instruction(line: &str) -> Instruction {
      7     if &line[..4] == "addx" {
      8         let n = line[5..line.len()-1].parse::<i64>().unwrap();
      9         Instruction::Add(n)
     10     } else {
     11         Instruction::Noop
     12     }
     13 }