declaration of display grid
This commit is contained in:
parent
a1080587d1
commit
c0f0a92a76
31
src/main.rs
31
src/main.rs
@ -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"),
|
print!(" ");
|
||||||
"S" => println!("fleche en bas"),
|
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!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user