diff options
| author | Mica White <botahamec@outlook.com> | 2025-12-08 19:56:48 -0500 |
|---|---|---|
| committer | Mica White <botahamec@outlook.com> | 2025-12-08 19:56:48 -0500 |
| commit | fdb2804883deb31e3aeb15bbe588dcc9b7b76bd0 (patch) | |
| tree | a4c51cd88664cab7b6673dcd3b425fb7a0202a38 /engine/src/info.rs | |
| parent | 93461aa9399d981db7d8611b3eb166636de4d971 (diff) | |
Diffstat (limited to 'engine/src/info.rs')
| -rwxr-xr-x | engine/src/info.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/engine/src/info.rs b/engine/src/info.rs new file mode 100755 index 0000000..4588941 --- /dev/null +++ b/engine/src/info.rs @@ -0,0 +1,27 @@ +use std::marker::PhantomData;
+use std::time::Instant;
+
+use model::Move;
+
+use crate::Evaluation;
+
+#[derive(Debug, Clone, Copy)]
+pub struct EvalInfo {
+ pub start_time: Instant,
+ pub nodes_searched: usize,
+ pub evaluation: Evaluation,
+ pub current_best_move: Option<Move>,
+ pub current_depth: u8,
+ pub(crate) _unused: PhantomData<()>,
+}
+
+impl EvalInfo {
+ pub fn nodes_per_second(&self) -> usize {
+ let elapsed = self.start_time.elapsed().as_secs_f64();
+ (self.nodes_searched as f64 / elapsed) as usize
+ }
+
+ pub fn elapsed_milliseconds(self) -> u32 {
+ self.start_time.elapsed().as_millis() as u32
+ }
+}
|
