diff --git a/src/repr.rs b/src/repr.rs index 731fb9e..81e3923 100644 --- a/src/repr.rs +++ b/src/repr.rs @@ -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(()) } }