Skip to content

Commit ee856e2

Browse files
committed
add fmt trait for entry
1 parent 02604c6 commit ee856e2

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/common/entry.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::fmt;
2+
13
use crate::chess::{position::Position, r#move::Move};
24

35
use super::{
@@ -30,6 +32,20 @@ impl TrainingDataEntry {
3032
}
3133
}
3234

35+
impl fmt::Display for TrainingDataEntry {
36+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
37+
write!(
38+
f,
39+
"{} {} {} {} {}",
40+
self.pos.fen().unwrap(),
41+
self.mv.as_uci(),
42+
self.score,
43+
self.ply,
44+
self.result
45+
)
46+
}
47+
}
48+
3349
#[derive(Debug, Default, Clone)]
3450
pub struct PackedTrainingDataEntry {
3551
pub data: [u8; 32],

0 commit comments

Comments
 (0)