Skip to content

Commit

Permalink
refactor: added automatic time type to perft
Browse files Browse the repository at this point in the history
  • Loading branch information
Saphereye committed Sep 24, 2024
1 parent 2a1e33e commit b1ec217
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/definitions/board.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::fmt;
use std::hash::{Hash, Hasher};
use std::time::Instant;
use std::time::{Duration, Instant};

use crate::definitions::bitboards::BitBoard;
use crate::definitions::castling::{CastleType, Castling};
Expand Down Expand Up @@ -1405,10 +1405,10 @@ impl Board {

let elapsed_time = start_time.elapsed();
println!(
"Total nodes: {}, total time elapsed: {:.2?}, time per node: {:.6?}μs, NPS: {:.0}",
"Total nodes: {}, total time elapsed: {:.2?}, time per node: {:.2?}, NPS: {:.0} n/s",
total_nodes,
elapsed_time,
(elapsed_time.as_secs_f64() / (total_nodes as f64)) * 1_000_000.0,
Duration::from_secs_f64((elapsed_time.as_secs_f64() / (total_nodes as f64))),
(total_nodes as f64) / (elapsed_time.as_secs_f64())
);

Expand Down

0 comments on commit b1ec217

Please sign in to comment.