1
0

disable day 14 part 2 because it requires manual intervention

This commit is contained in:
2024-12-15 17:22:55 +01:00
parent c1abd8d8f8
commit e135a6a349
2 changed files with 15 additions and 8 deletions

View File

@@ -6,3 +6,7 @@ edition = "2021"
[dependencies] [dependencies]
itertools = "0.13.0" itertools = "0.13.0"
regex = "1.11.1" regex = "1.11.1"
[profile.dev]
opt-level = 3

View File

@@ -1,7 +1,7 @@
use std::{ use std::{
collections::HashSet, collections::HashSet,
fs::read_to_string, fs::read_to_string,
io::{self, BufRead}, // io::{self, BufRead},
}; };
use itertools::Itertools; use itertools::Itertools;
@@ -99,20 +99,23 @@ fn part2(input: &str) -> RiddleResult {
}); });
if robots.iter().filter(|(s, _)| grid[*s] > 1).count() > robots.len() * 70 / 100 { if robots.iter().filter(|(s, _)| grid[*s] > 1).count() > robots.len() * 70 / 100 {
printr(&robots, width, height); // printr(&robots, width, height);
println!("after {} seconds. Press enter to continue or type 'merry christmas' if you can spot a tree!", second + 1); //+1 because we look at it after they have changed // println!("after {} seconds. Press enter to continue or type 'merry christmas' if you can spot a tree!", second + 1); //+1 because we look at it after they have changed
let stdin = io::stdin();
let line = stdin.lock().lines().next().unwrap().unwrap();
if line.as_str().eq_ignore_ascii_case("merry christmas") {
return second + 1; return second + 1;
} // let stdin = io::stdin();
// let line = stdin.lock().lines().next().unwrap().unwrap();
// if line.as_str().eq_ignore_ascii_case("merry christmas") {
// return second + 1;
// }
} }
} }
unreachable!() unreachable!()
} }
#[allow(unused)]
type Robot = ((i64, i64), (i64, i64)); type Robot = ((i64, i64), (i64, i64));
#[allow(unused)]
fn printr(robots: &[Robot], width: i64, height: i64) { fn printr(robots: &[Robot], width: i64, height: i64) {
for y in 0..height { for y in 0..height {
for x in 0..width { for x in 0..width {