dancing_droids/src/main.rs

36 lines
615 B
Rust
Raw Normal View History

2020-10-11 18:25:42 +02:00
enum Orientation {
2020-10-06 23:25:17 +02:00
N,
E,
S,
W,
2020-10-06 20:34:48 +02:00
}
2020-10-06 23:25:17 +02:00
2020-10-11 18:25:42 +02:00
enum Instruction {
L,
R,
F,
}
fn parse_orientation(c: char) -> Option<Orientation> {
match c {
'N' => Some(Orientation::N),
'E' => Some(Orientation::E),
'S' => Some(Orientation::S),
'W' => Some(Orientation::W),
_ => None,
}
}
fn parse_instruction(c: char) -> Option<Instruction> {
match c {
'L' => Some(Instruction::L),
'R' => Some(Instruction::R),
'F' => Some(Instruction::F),
_ => None,
}
}
fn main() {
let file_data = include_str!("../two_robots.txt");
}