diff --git a/src/main.rs b/src/main.rs index 52eebf3..4489af9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -59,6 +59,7 @@ fn create_hash_map(pool: &Vec, hash: &mut HashMap) -> Result { let w = world::random_world(); let mut rng = rand::thread_rng(); diff --git a/src/robot.rs b/src/robot.rs index aa96587..aa8d9e7 100644 --- a/src/robot.rs +++ b/src/robot.rs @@ -59,6 +59,7 @@ pub enum Orientation { W, } +/// Return new Orientation with a left move apply to it. fn turn_left(o: &Orientation) -> Orientation { match o { Orientation::N => Orientation::W, @@ -67,6 +68,8 @@ fn turn_left(o: &Orientation) -> Orientation { Orientation::W => Orientation::S, } } + +/// Return new Orientation with a right move apply to it. fn turn_right(o: &Orientation) -> Orientation { match o { Orientation::N => Orientation::E, @@ -84,6 +87,7 @@ pub enum Instruction { F, } +/// Convert a string of instructions to a Vec of instructions. pub fn instructions_from_string(s: String) -> Result, String> { let mut v: Vec = Vec::new(); for c in s.chars() {