diff --git a/src/main.rs b/src/main.rs index 143631b..22feaca 100644 --- a/src/main.rs +++ b/src/main.rs @@ -247,6 +247,8 @@ fn main() -> Result<(), Box> { let world: world::World = parse_config(raw_conf, &mut robot_pool)?; let mut hash: HashMap = HashMap::new(); create_hash_map(&robot_pool, &mut hash); + println!("World {{ x_max = {}; y_max = {} }}", world.x, world.y); + robot::print_robots(&robot_pool); println!("Initial state"); println!("=============="); display_grid(&world, &robot_pool, &hash); diff --git a/src/robot.rs b/src/robot.rs index 25edfc3..ad6552f 100644 --- a/src/robot.rs +++ b/src/robot.rs @@ -77,6 +77,27 @@ pub fn is_piouff(r: &Robot) -> bool { false } +/// Print robots id, position and instructions. +pub fn print_robots(robot_pool: &Vec) { + println!("Robots ["); + for r in robot_pool { + println!( + "{{ id = {}, x = {}; y = {}; orientation: {}, instructions: {:?}, }},", + r.id, + r.p.x, + r.p.y, + match r.o { + Orientation::N => "Norts", + Orientation::S => "South", + Orientation::E => "East", + Orientation::W => "West", + }, + r.i + ); + } + println!("]"); +} + #[cfg(test)] mod tests { use super::*;