From 1f3c90ff35320973201ec565720d1a5d9bfe258f Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Mon, 25 Mar 2024 10:38:02 -0700 Subject: [PATCH] [position] Print the chess board diagram with box drawing characters --- position/src/position/diagram_formatter.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/position/src/position/diagram_formatter.rs b/position/src/position/diagram_formatter.rs index 9dfb5c7..64eb507 100644 --- a/position/src/position/diagram_formatter.rs +++ b/position/src/position/diagram_formatter.rs @@ -14,23 +14,23 @@ impl<'a> DiagramFormatter<'a> { impl<'a> fmt::Display for DiagramFormatter<'a> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, " +-----------------+\n")?; + write!(f, " ╔═════════════════╗\n")?; for rank in Rank::ALL.iter().rev() { - write!(f, "{rank} | ")?; + write!(f, "{rank} ║ ")?; for file in File::ALL.iter() { let square = Square::from_file_rank(*file, *rank); match self.0.piece_on_square(square) { Some(placed_piece) => write!(f, "{} ", placed_piece.piece())?, - None => write!(f, ". ")?, + None => write!(f, "· ")?, } } - write!(f, "|\n")?; + write!(f, "║\n")?; } - write!(f, " +-----------------+\n")?; + write!(f, " ╚═════════════════╝\n")?; write!(f, " a b c d e f g h\n")?; Ok(())