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