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