Merge branch 'martin-dev' into 'master'
Merge martin-dev to master See merge request mhart/DancingDroids!8
This commit is contained in:
commit
236f9c7ecf
27
src/main.rs
27
src/main.rs
@ -1,14 +1,35 @@
|
|||||||
enum Orientations {
|
enum Orientation {
|
||||||
N,
|
N,
|
||||||
E,
|
E,
|
||||||
S,
|
S,
|
||||||
W,
|
W,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Instructions {
|
enum Instruction {
|
||||||
L,
|
L,
|
||||||
R,
|
R,
|
||||||
F,
|
F,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn parse_orientation(c: char) -> Result<Orientation, &'static str> {
|
||||||
|
match c {
|
||||||
|
'N' => Ok(Orientation::N),
|
||||||
|
'E' => Ok(Orientation::E),
|
||||||
|
'S' => Ok(Orientation::S),
|
||||||
|
'W' => Ok(Orientation::W),
|
||||||
|
_ => Err("Invalid character, does not match any orientations"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn parse_instruction(c: char) -> Result<Instruction, &'static str> {
|
||||||
|
match c {
|
||||||
|
'L' => Ok(Instruction::L),
|
||||||
|
'R' => Ok(Instruction::R),
|
||||||
|
'F' => Ok(Instruction::F),
|
||||||
|
_ => Err("Invalid character, does not match any instructions"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let file_data = include_str!("../two_robots.txt");
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user