Day 2 and 3 improvements

This commit is contained in:
Max
2022-12-04 15:01:22 +01:00
parent 129c9f85a0
commit 6ba1e39d98
2 changed files with 9 additions and 12 deletions

View File

@ -10,12 +10,9 @@ enum Symbol {
impl From<char> for Symbol {
fn from(value: char) -> Self {
match value {
'A' => Self::Rock,
'B' => Self::Paper,
'C' => Self::Scissors,
'X' => Self::Rock,
'Y' => Self::Paper,
'Z' => Self::Scissors,
'A' | 'X' => Self::Rock,
'B' | 'Y' => Self::Paper,
'C' | 'Z' => Self::Scissors,
_ => panic!("invalid input"),
}
}