|
@@ -5,7 +5,7 @@ use movegen::*;
|
|
use std::io::BufRead;
|
|
use std::io::BufRead;
|
|
use std::process::exit;
|
|
use std::process::exit;
|
|
use std::sync::mpsc::{Sender, self};
|
|
use std::sync::mpsc::{Sender, self};
|
|
-use std::time::Duration;
|
|
|
|
|
|
+use std::time::{Duration, Instant};
|
|
use zobrist::ZobristTable;
|
|
use zobrist::ZobristTable;
|
|
use std::thread;
|
|
use std::thread;
|
|
|
|
|
|
@@ -191,7 +191,19 @@ impl Engine {
|
|
if si.perft {
|
|
if si.perft {
|
|
let depth = si.depth.unwrap_or(0);
|
|
let depth = si.depth.unwrap_or(0);
|
|
let mut pc = SearchControl::new_perft(&self.board, rcv, depth);
|
|
let mut pc = SearchControl::new_perft(&self.board, rcv, depth);
|
|
- let search_rtn = move || pc.perft(depth);
|
|
|
|
|
|
+ let search_rtn = move || {
|
|
|
|
+ let before = Instant::now();
|
|
|
|
+ let rv = pc.perft(depth);
|
|
|
|
+ if !rv {
|
|
|
|
+ let after = Instant::now();
|
|
|
|
+ let nodes = pc.nodes;
|
|
|
|
+ let duration = after - before;
|
|
|
|
+ let nps = nodes / duration.as_millis() as usize * 1000;
|
|
|
|
+ println!("finished in {} ms", duration.as_millis());
|
|
|
|
+ println!("nodes: {} nps: {}", nodes, nps);
|
|
|
|
+ }
|
|
|
|
+ rv
|
|
|
|
+ };
|
|
thread::spawn(search_rtn)
|
|
thread::spawn(search_rtn)
|
|
}
|
|
}
|
|
else {
|
|
else {
|