diff --git a/rust/day2/Cargo.lock b/rust/day2/Cargo.lock new file mode 100644 index 0000000..7edf7cd --- /dev/null +++ b/rust/day2/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aoc-day2" +version = "0.1.0" diff --git a/rust/day2/Cargo.toml b/rust/day2/Cargo.toml new file mode 100644 index 0000000..69b3e00 --- /dev/null +++ b/rust/day2/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "aoc-day2" +version = "0.1.0" +edition = "2021" +authors = ["Yohan Boujon "] + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] + +[workspace] diff --git a/rust/day2/src/main.rs b/rust/day2/src/main.rs new file mode 100644 index 0000000..2307fe5 --- /dev/null +++ b/rust/day2/src/main.rs @@ -0,0 +1,10 @@ +use crate::rps::get_converter; + +use std::collections::HashMap; +mod rps; + +fn main() +{ + let converter : HashMap = rps::get_converter(); + println!("Hello world!"); +} \ No newline at end of file diff --git a/rust/day2/src/rps.rs b/rust/day2/src/rps.rs new file mode 100644 index 0000000..03ac721 --- /dev/null +++ b/rust/day2/src/rps.rs @@ -0,0 +1,18 @@ +use std::collections::HashMap; + +pub enum RockPaperScissors { + Rock, + Paper, + Scissors +} + +pub fn get_converter() -> HashMap { + HashMap::from([ + ('A', RockPaperScissors::Rock), + ('B', RockPaperScissors::Paper), + ('C', RockPaperScissors::Scissors), + ('X', RockPaperScissors::Rock), + ('Y', RockPaperScissors::Paper), + ('Z', RockPaperScissors::Scissors), + ]) +} \ No newline at end of file