simplify fmt
This commit is contained in:
parent
30088f228a
commit
17e774ae57
@ -40,8 +40,9 @@ pub struct Board {
|
||||
|
||||
impl fmt::Display for Board {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
let horiz_sep_line = "-".repeat(BOARD_SIZE * 2 + 1);
|
||||
for i in 0..BOARD_SIZE {
|
||||
writeln!(f, "{}", "-".repeat(BOARD_SIZE * 2 + 1))?;
|
||||
writeln!(f, "{}", horiz_sep_line)?;
|
||||
|
||||
write!(f, "|")?;
|
||||
for j in 0..BOARD_SIZE {
|
||||
@ -53,7 +54,10 @@ impl fmt::Display for Board {
|
||||
}
|
||||
writeln!(f)?;
|
||||
}
|
||||
writeln!(f, "{}", "-".repeat(BOARD_SIZE * 2 + 1))?;
|
||||
|
||||
// put a line at the bottom of the board too
|
||||
writeln!(f, "{}", horiz_sep_line)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user