forked from pierront/rock-paper-scissors
Update src/main/java/fr/iut_fbleau/info/but3/automation/rock_paper_scissors/play/domain/Move.java
Some checks failed
rock-paper-scissors/pipeline/head There was a failure building this commit
Some checks failed
rock-paper-scissors/pipeline/head There was a failure building this commit
add WELL in the game, the WELL loose in front of the PAPER and win against the ROCK and the SCISSORS.
This commit is contained in:
@@ -3,13 +3,15 @@ package fr.iut_fbleau.info.but3.automation.rock_paper_scissors.play.domain;
|
|||||||
public enum Move {
|
public enum Move {
|
||||||
ROCK,
|
ROCK,
|
||||||
PAPER,
|
PAPER,
|
||||||
SCISSORS;
|
SCISSORS,
|
||||||
|
WELL;
|
||||||
|
|
||||||
public boolean beats(Move other) {
|
public boolean beats(Move other) {
|
||||||
return switch (this) {
|
return switch (this) {
|
||||||
case ROCK -> other == SCISSORS;
|
case ROCK -> other == SCISSORS;
|
||||||
case PAPER -> other == ROCK;
|
case PAPER -> (other == ROCK || other == WELL );
|
||||||
case SCISSORS -> other == PAPER;
|
case SCISSORS -> other == PAPER;
|
||||||
|
case WELL -> (other == ROCK || other == SCISSORS);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user