Compare commits
2 Commits
e304f519ab
...
9af5bc0269
Author | SHA1 | Date |
---|---|---|
b1ek | 9af5bc0269 | |
b1ek | abe8659823 |
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
|
|
||||||
use powlib::{self, gen::{POWRange, POWChallenge}, hash::hash_num, num::Num};
|
use powlib::{self, gen::{POWRange, POWChallenge}, hash::hash_num, num::Num, solver::POWSolver};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
{
|
{
|
||||||
|
@ -13,6 +13,7 @@ fn main() {
|
||||||
{
|
{
|
||||||
let time = Instant::now();
|
let time = Instant::now();
|
||||||
let challenge = POWChallenge::make(POWRange::new(0, 20480));
|
let challenge = POWChallenge::make(POWRange::new(0, 20480));
|
||||||
println!("Solvling {} took {} seconds", challenge.solve_singlethread(), time.elapsed().as_secs_f32());
|
let mut solver = POWSolver::new(challenge);
|
||||||
|
println!("Solvling {} took {} seconds", solver.solve_signle().unwrap(), time.elapsed().as_secs_f32());
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -53,6 +53,13 @@ impl POWSolver {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Solve the challenge using just one thread.
|
||||||
|
*/
|
||||||
|
pub fn solve_signle(self: &mut POWSolver) -> Option<u128> {
|
||||||
|
return self.chunk_solve(self.challenge.range.min, self.challenge.range.max);
|
||||||
|
}
|
||||||
|
|
||||||
pub fn new(challenge: POWChallenge) -> POWSolver {
|
pub fn new(challenge: POWChallenge) -> POWSolver {
|
||||||
POWSolver { challenge, result: None }
|
POWSolver { challenge, result: None }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue