y2024d3 first try part 2

This commit is contained in:
2024-12-03 10:11:59 +01:00
parent 4d1477d7c1
commit f468af10f4
10 changed files with 298 additions and 0 deletions

View 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
View 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
View 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);
}
}

View File

@@ -24,3 +24,5 @@ pub mod d20;
pub mod d21;
pub mod d22;
pub mod d23;