prettier board
This commit is contained in:
parent
672f9e09bf
commit
4506001dfc
1 changed files with 16 additions and 20 deletions
|
|
@ -117,14 +117,6 @@ impl Default for GameState {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
what we're going for:
|
||||
-- -- --
|
||||
| | |P2|
|
||||
-- -- --
|
||||
|P1| | |
|
||||
-- -- --
|
||||
*/
|
||||
impl Display for GameState {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
writeln!(
|
||||
|
|
@ -132,27 +124,31 @@ impl Display for GameState {
|
|||
"P1: {}, P2: {}\n",
|
||||
self.p1.walls_left, self.p2.walls_left
|
||||
)?;
|
||||
writeln!(f, "┏━━┬━━┬━━┬━━┬━━┬━━┬━━┬━━┬━━┓")?;
|
||||
for y in 0..9 {
|
||||
for x in 0..9 {
|
||||
if y > 0 {
|
||||
let wall = if !self.walls.can_walk_between(x, y - 1, x, y) {
|
||||
if y > 0 {
|
||||
write!(f, "├")?;
|
||||
for x in 0..9 {
|
||||
let wall = if self.walls.can_walk_between(x, y - 1, x, y) {
|
||||
' '
|
||||
} else {
|
||||
'-'
|
||||
'━'
|
||||
};
|
||||
write!(f, "{wall}{wall}")?;
|
||||
if x != 8 {
|
||||
write!(f, "╋")?;
|
||||
}
|
||||
}
|
||||
if x != 8 {
|
||||
write!(f, " ")?;
|
||||
}
|
||||
write!(f, "┤\n┃")?;
|
||||
} else {
|
||||
write!(f, "┃")?;
|
||||
}
|
||||
writeln!(f, "")?;
|
||||
for x in 0..9 {
|
||||
if x > 0 {
|
||||
let wall = if !self.walls.can_walk_between(x - 1, y, x, y) {
|
||||
let wall = if self.walls.can_walk_between(x - 1, y, x, y) {
|
||||
' '
|
||||
} else {
|
||||
'|'
|
||||
'┃'
|
||||
};
|
||||
write!(f, "{wall}")?;
|
||||
}
|
||||
|
|
@ -165,9 +161,9 @@ impl Display for GameState {
|
|||
};
|
||||
write!(f, "{player}")?;
|
||||
}
|
||||
writeln!(f, "")?;
|
||||
writeln!(f, "┃")?;
|
||||
}
|
||||
writeln!(f, "")?;
|
||||
writeln!(f, "┗━━┴━━┴━━┴━━┴━━┴━━┴━━┴━━┴━━┛")?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue