declaration of display grid

This commit is contained in:
EliasCubz 2020-11-01 15:49:02 +01:00
parent a1080587d1
commit c0f0a92a76

View File

@ -198,19 +198,26 @@ fn open_file(filename: &str) -> io::Result<String> {
Ok(content)
}
fn display_grid(h: HashMap<>, ){
for (i=0;j<xmax;++j){
for(r.p.x == j && r.p.y==i){
match some(hash.get(position{x: j, y: i})) =>
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<robot::Robot>,
h: &HashMap<robot::Position, u32>,
) {
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!()
}
}
}