1
0

Better visibility for functions and enum.

This commit is contained in:
Pcornat 2022-12-04 21:05:22 +01:00
parent 29956ee857
commit 10b594e479
Signed by: Pcornat
GPG Key ID: 2F3932FF46D9ECA0

View File

@ -1,5 +1,5 @@
#[derive(PartialEq, Eq)] #[derive(PartialEq, Eq)]
pub enum Play { enum Play {
Rock, Rock,
Paper, Paper,
Scissors, Scissors,
@ -56,7 +56,7 @@ impl Into<i32> for ResultPlay {
} }
} }
pub fn round_score(play: char, counter_play: char) -> i32 { fn round_score(play: char, counter_play: char) -> i32 {
let coup = Play::from(play); // translate to the play let coup = Play::from(play); // translate to the play
let counter = Play::from(counter_play); // translate to the play let counter = Play::from(counter_play); // translate to the play
if coup == counter { if coup == counter {
@ -122,7 +122,7 @@ fn getting_score(game_output: &ResultPlay, play: Play) -> i32 {
game + play_result game + play_result
} }
pub fn second_strat(play: char, strat: char) -> i32 { fn second_strat(play: char, strat: char) -> i32 {
let coup = Play::from(play); let coup = Play::from(play);
let response = match strat { let response = match strat {
'X' => ResultPlay::Loss, 'X' => ResultPlay::Loss,