day 02
This commit is contained in:
parent
a49f204feb
commit
462782ad30
@ -1,5 +1,4 @@
|
||||
use std::fs;
|
||||
|
||||
const DRAW_SCORE: i32 = 3;
|
||||
const WIN_SCORE: i32 = 6;
|
||||
const LOSE_SCORE: i32 = 0;
|
||||
@ -79,7 +78,7 @@ fn find_needed_shape_for_right(left: &str, win_state: WinState) -> String {
|
||||
},
|
||||
WinState::Error => todo!(),
|
||||
};
|
||||
return String::from(shape);
|
||||
String::from(shape)
|
||||
}
|
||||
|
||||
fn find_complicated_result(left: &str, right: &str) -> i32 {
|
||||
@ -104,20 +103,20 @@ fn find_result(left: &str, right: &str) -> i32 {
|
||||
}
|
||||
}
|
||||
fn shape_score(shape: Shape) -> i32 {
|
||||
return match shape {
|
||||
match shape {
|
||||
Shape::Rock => 1,
|
||||
Shape::Paper => 2,
|
||||
Shape::Scissors => 3,
|
||||
Shape::Error => 0,
|
||||
};
|
||||
}
|
||||
}
|
||||
fn string_to_shape(shapestring: &str) -> Shape {
|
||||
return match shapestring {
|
||||
match shapestring {
|
||||
"A" | "X" => Shape::Rock,
|
||||
"B" | "Y" => Shape::Paper,
|
||||
"C" | "Z" => Shape::Scissors,
|
||||
_ => Shape::Error,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
Loading…
Reference in New Issue
Block a user