Add parse_instruction()
Same as the parse_orientation() function but for the instruction model
This commit is contained in:
		
							parent
							
								
									c1143ee396
								
							
						
					
					
						commit
						c2d6e3422d
					
				@ -21,6 +21,15 @@ fn parse_orientation(c: char) -> Option<Orientation> {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fn parse_instruction(c: char) -> Option<Instruction> {
 | 
				
			||||||
 | 
					    match c {
 | 
				
			||||||
 | 
					        'L' => Some(Instruction::L),
 | 
				
			||||||
 | 
					        'R' => Some(Instruction::R),
 | 
				
			||||||
 | 
					        'F' => Some(Instruction::F),
 | 
				
			||||||
 | 
					        _ => None,
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn main() {
 | 
					fn main() {
 | 
				
			||||||
    let file_data = include_str!("../two_robots.txt");
 | 
					    let file_data = include_str!("../two_robots.txt");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user