lots of stuff ive done.

maybe a status would be good?
This commit is contained in:
2025-08-29 08:12:33 -04:00
parent a48f5f6d11
commit 8aa7fe572f
66 changed files with 19390 additions and 142 deletions
+36
View File
@@ -0,0 +1,36 @@
// do part 1a but figure out the first repeated value
use std::collections::HashMap;
use aoc::read_data;
fn main() {
let mut visited_locations: HashMap<i32, i32> = HashMap::from([(0, 0)]);
// let binding = read_data("2018_01_data.txt");
// let lines = binding.lines();
let lines = "-6\n+3\n+8\n+5\n-6".to_string();
let mut working_value = 0i32;
for line in lines.lines() {
let (direction, velocity) = line.split_at(1);
// println!("{line} split to ||{direction}|| and ||{velocity}||");
let direction_val : i32 = velocity.parse().unwrap();
match direction {
"+" => {
working_value += direction_val;
}
"-" => {
working_value -= direction_val;
}
_ => {
unreachable!("Invalid direction");
}
}
print!("{working_value}\t");
if let Some(found) = visited_locations.get(&working_value) {
println!("GET SUCCESS -> {working_value} / {found}");
break;
}
visited_locations.insert(working_value, 0);
}
}
// BROKEN