day 23 part 1
This commit is contained in:
@@ -9,12 +9,13 @@ fn parse(input: &str) -> Input {
|
|||||||
|
|
||||||
#[aoc(day23, part1)]
|
#[aoc(day23, part1)]
|
||||||
fn part1(input: &Input) -> usize {
|
fn part1(input: &Input) -> usize {
|
||||||
let mut a = 0;
|
run(input.lines().collect(), 0)
|
||||||
|
}
|
||||||
|
fn run(mem: Vec<&str>, a: i32) -> usize {
|
||||||
|
let mut a = a;
|
||||||
let mut b = 0;
|
let mut b = 0;
|
||||||
let mut ip: i32 = 0;
|
let mut ip: i32 = 0;
|
||||||
|
|
||||||
let mem = input.lines().collect::<Vec<_>>();
|
|
||||||
|
|
||||||
while let Some(line) = mem.get(ip as usize) {
|
while let Some(line) = mem.get(ip as usize) {
|
||||||
let (lhs, rhs) = line.split_once(" ").unwrap();
|
let (lhs, rhs) = line.split_once(" ").unwrap();
|
||||||
match lhs {
|
match lhs {
|
||||||
@@ -73,7 +74,6 @@ fn part1(input: &Input) -> usize {
|
|||||||
}
|
}
|
||||||
b
|
b
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_offset(input: &str) -> i32 {
|
fn parse_offset(input: &str) -> i32 {
|
||||||
input.parse().unwrap()
|
input.parse().unwrap()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user