Robot type
This commit is contained in:
parent
6f34f27eaa
commit
f88c972ceb
@ -17,6 +17,8 @@ use clap::{App, Arg};
|
||||
use std::fs;
|
||||
use std::io;
|
||||
|
||||
mod robot;
|
||||
|
||||
/// Retrieve the content of a file and return it as a string.
|
||||
fn open_file(filename: &str) -> io::Result<String> {
|
||||
let content = fs::read_to_string(filename)?;
|
||||
|
21
src/robot.rs
Normal file
21
src/robot.rs
Normal file
@ -0,0 +1,21 @@
|
||||
/// A Robot *aka droid* is represented here.
|
||||
/// Each robot must have a unique id.
|
||||
pub struct Robot {
|
||||
id: u32,
|
||||
o: Orientation,
|
||||
p: Position,
|
||||
}
|
||||
|
||||
/// Enum to store all possible orientations.
|
||||
enum Orientation {
|
||||
N,
|
||||
E,
|
||||
S,
|
||||
W,
|
||||
}
|
||||
|
||||
/// Struct to store robot position.
|
||||
struct Position {
|
||||
x: i32,
|
||||
y: i32,
|
||||
}
|
Loading…
Reference in New Issue
Block a user