declaration of display grid

This commit is contained in:
EliasCubz 2020-11-01 15:49:02 +01:00
parent a1080587d1
commit c0f0a92a76
1 changed files with 19 additions and 12 deletions

View File

@ -198,19 +198,26 @@ fn open_file(filename: &str) -> io::Result<String> {
Ok(content) Ok(content)
} }
fn display_grid(h: HashMap<>, ){ fn display_grid(
for (i=0;j<xmax;++j){ w: &world::World,
for(r.p.x == j && r.p.y==i){ robot_pool: &Vec<robot::Robot>,
match some(hash.get(position{x: j, y: i})) => h: &HashMap<robot::Position, u32>,
match robot_pool[id-1].o { ) {
"N" => println!("fleche du haut"), for i in (0..w.y).rev() {
"E" => println!("fleche a droite"),
"W" => println!("fleche a gauche"),
"S" => println!("fleche en bas"),
print!(" ");
for j in 0..w.x {
print!("{} ", i);
match h.get(Position{ x: j, y: i }) {
some(id) => match robot_pool[(id - 1) as usize].o {
robot::Orientation::N => print!(""),
robot::Orientation::E => print!(""),
robot::Orientation::S => print!(""),
robot::Orientation::W => print!(""),
None => print!("."),
}, },
None => println!("."), }
println!()
} }
} }
} }