add: broken stuff
This commit is contained in:
+9
-11
@@ -1,4 +1,9 @@
|
||||
use std::{collections::{HashMap, HashSet}, process::exit, thread, time::Duration};
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
process::exit,
|
||||
thread,
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use advent_of_code_2024::{make_main, SResult};
|
||||
use regex::Regex;
|
||||
@@ -124,29 +129,22 @@ fn solve(lines: Vec<String>) -> SResult<(usize, usize)> {
|
||||
let pool = ThreadPool::new(20);
|
||||
//let mut n = 3536000000;
|
||||
let mut n = 0;
|
||||
let mut prev_best = 0;
|
||||
let program: &'static mut [usize] = program.leak();
|
||||
loop {
|
||||
{
|
||||
let n = n;
|
||||
let program: &'static [usize] = program;
|
||||
pool.execute(move || {
|
||||
let values = State::new(&program, [n, 0, 0]).run_to_end();
|
||||
if values.len() > 4 {
|
||||
if values.len() > prev_best {
|
||||
println!("{} => {:?}", n, values);
|
||||
prev_best = values.len();
|
||||
}
|
||||
while &values == program {
|
||||
println!("finished at {}", n);
|
||||
//exit(n as i32);
|
||||
}
|
||||
});
|
||||
}
|
||||
n += 1;
|
||||
if n % 1000000 == 0 {
|
||||
println!("n = {}", n);
|
||||
}
|
||||
while pool.queued_count() > 10000 {
|
||||
thread::sleep(Duration::from_millis(10));
|
||||
}
|
||||
}
|
||||
Ok((values.len(), n))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user