Merge branch 'fix-display' into 'master'

fixed size of displayed grid

See merge request mhart/DancingDroids!54
This commit is contained in:
Martin HART 2020-11-07 14:17:13 +01:00
commit 48c78dab70
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 {