simplify board format score

This commit is contained in:
Simon Gardling 2025-02-19 21:52:20 -05:00
parent f3742ce674
commit 34d1b0dcef
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D

View File

@ -149,11 +149,12 @@ impl fmt::Display for Board {
writeln!(f, " {}", horiz_sep_line)?; writeln!(f, " {}", horiz_sep_line)?;
// Print the current score // Print the current score
writeln!( write!(
f, f,
"White Score: {}\nBlack Score: {}", "{}",
self.count(Piece::White), [Piece::White, Piece::Black]
self.count(Piece::Black) .map(|p| format!("{} Score: {}\n", p.text(), self.count(p)))
.concat()
)?; )?;
Ok(()) Ok(())