y2024d3 first try part 2
This commit is contained in:
49
y2015/resources/23_input.txt
Normal file
49
y2015/resources/23_input.txt
Normal file
@@ -0,0 +1,49 @@
|
||||
jio a, +19
|
||||
inc a
|
||||
tpl a
|
||||
inc a
|
||||
tpl a
|
||||
inc a
|
||||
tpl a
|
||||
tpl a
|
||||
inc a
|
||||
inc a
|
||||
tpl a
|
||||
tpl a
|
||||
inc a
|
||||
inc a
|
||||
tpl a
|
||||
inc a
|
||||
inc a
|
||||
tpl a
|
||||
jmp +23
|
||||
tpl a
|
||||
tpl a
|
||||
inc a
|
||||
inc a
|
||||
tpl a
|
||||
inc a
|
||||
inc a
|
||||
tpl a
|
||||
inc a
|
||||
tpl a
|
||||
inc a
|
||||
tpl a
|
||||
inc a
|
||||
tpl a
|
||||
inc a
|
||||
inc a
|
||||
tpl a
|
||||
inc a
|
||||
inc a
|
||||
tpl a
|
||||
tpl a
|
||||
inc a
|
||||
jio a, +8
|
||||
inc b
|
||||
jie a, +4
|
||||
tpl a
|
||||
inc a
|
||||
jmp +2
|
||||
hlf a
|
||||
jmp -7
|
20
y2015/src/bin/d23.rs
Normal file
20
y2015/src/bin/d23.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
use std::fs;
|
||||
|
||||
use y2015::days::d23;
|
||||
|
||||
fn main() {
|
||||
part1();
|
||||
part2();
|
||||
}
|
||||
|
||||
fn part1() {
|
||||
let root = env!("CARGO_MANIFEST_DIR");
|
||||
let content = fs::read_to_string(format!("{root}/resources/23_input.txt")).unwrap();
|
||||
println!("{}", d23::process_part1(&content));
|
||||
}
|
||||
|
||||
fn part2() {
|
||||
let root = env!("CARGO_MANIFEST_DIR");
|
||||
let content = fs::read_to_string(format!("{root}/resources/23_input.txt")).unwrap();
|
||||
println!("{}", d23::process_part2(&content));
|
||||
}
|
45
y2015/src/days/d23.rs
Normal file
45
y2015/src/days/d23.rs
Normal file
@@ -0,0 +1,45 @@
|
||||
enum Instruction {
|
||||
Half,
|
||||
Triple,
|
||||
Increment,
|
||||
Jump,
|
||||
JumpEven,
|
||||
JumpOne,
|
||||
}
|
||||
|
||||
pub fn process_part1(input: &str) -> i32 {
|
||||
let mut a = 0;
|
||||
let mut b = 0;
|
||||
let lines = input
|
||||
.lines()
|
||||
.map(|line| line.to_string())
|
||||
.collect::<Vec<String>>();
|
||||
let mut idx = 0;
|
||||
b
|
||||
}
|
||||
|
||||
pub fn process_part2(input: &str) -> i32 {
|
||||
0
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
const INPUT: &str = "inc a
|
||||
jio a, +2
|
||||
tpl a
|
||||
inc a";
|
||||
|
||||
#[test]
|
||||
fn part1() {
|
||||
let result = process_part1(INPUT);
|
||||
assert_eq!(result, 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn part2() {
|
||||
let result = process_part2(INPUT);
|
||||
assert_eq!(result, 0);
|
||||
}
|
||||
}
|
@@ -24,3 +24,5 @@ pub mod d20;
|
||||
pub mod d21;
|
||||
|
||||
pub mod d22;
|
||||
|
||||
pub mod d23;
|
||||
|
Reference in New Issue
Block a user