tidy up
This commit is contained in:
parent
8dfa008aae
commit
0ce91d44c0
|
@ -107,11 +107,12 @@ pub fn part_2(input: &str) -> u64 {
|
|||
|
||||
for throw in throws {
|
||||
let mut throw: Vec<&str> = throw.split_whitespace().take(2).collect();
|
||||
let player = throw.pop().unwrap();
|
||||
|
||||
let outcome= Outcome::from_str(throw.pop().unwrap()).unwrap();
|
||||
let opponent = Move::from_str(throw.pop().unwrap()).unwrap();
|
||||
|
||||
let player = match Outcome::from_str(player).unwrap() {
|
||||
Outcome::Win => opponent.is_beaten_by(),
|
||||
let player = match outcome {
|
||||
Outcome::Win => opponent.is_beaten_by(),
|
||||
Outcome::Draw => opponent.clone(),
|
||||
Outcome::Lose => opponent.beats(),
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue