From 34d1b0dcef1675126889bf0a79fd286b2aeadfcd Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Wed, 19 Feb 2025 21:52:20 -0500 Subject: [PATCH] simplify board format score --- src/board.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/board.rs b/src/board.rs index e4ea0b2..bee1900 100644 --- a/src/board.rs +++ b/src/board.rs @@ -149,11 +149,12 @@ impl fmt::Display for Board { writeln!(f, " {}", horiz_sep_line)?; // Print the current score - writeln!( + write!( f, - "White Score: {}\nBlack Score: {}", - self.count(Piece::White), - self.count(Piece::Black) + "{}", + [Piece::White, Piece::Black] + .map(|p| format!("{} Score: {}\n", p.text(), self.count(p))) + .concat() )?; Ok(())