fixed size of displayed grid

This commit is contained in:
Volodymyr Patuta 2020-11-07 13:40:17 +01:00
parent 2e05fd3ed3
commit d68c022cd7
1 changed files with 3 additions and 3 deletions

View File

@ -199,13 +199,13 @@ fn display_grid(
robot_pool: &Vec<robot::Robot>, robot_pool: &Vec<robot::Robot>,
h: &HashMap<robot::Position, u32>, h: &HashMap<robot::Position, u32>,
) { ) {
for i in (0..w.y).rev() { for i in (0..w.y + 1).rev() {
if i < 10 { if i < 10 {
print!("{} ", i); print!("{} ", i);
} else { } else {
print!("{} ", i); print!("{} ", i);
} }
for j in 0..w.x { for j in 0..w.x + 1 {
match h.get(&robot::Position { x: j, y: i }) { match h.get(&robot::Position { x: j, y: i }) {
Some(id) => match robot_pool[(id - 1) as usize].o { Some(id) => match robot_pool[(id - 1) as usize].o {
robot::Orientation::N => print!(""), robot::Orientation::N => print!(""),
@ -220,7 +220,7 @@ fn display_grid(
println!(); println!();
} }
print!(" "); print!(" ");
for j in 0..w.x { for j in 0..w.x + 1 {
if j < 10 { if j < 10 {
print!("{} ", j); print!("{} ", j);
} else { } else {