diff --git a/src/main.rs b/src/main.rs index 9fee27b..3c1f9f8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -198,19 +198,26 @@ fn open_file(filename: &str) -> io::Result { Ok(content) } -fn display_grid(h: HashMap<>, ){ - for (i=0;j - match robot_pool[id-1].o { - "N" => println!("fleche du haut"), - "E" => println!("fleche a droite"), - "W" => println!("fleche a gauche"), - "S" => println!("fleche en bas"), - +fn display_grid( + w: &world::World, + robot_pool: &Vec, + h: &HashMap, +) { + for i in (0..w.y).rev() { + + 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!() } } }