forked from pierront/rock-paper-scissors
maj
This commit is contained in:
@@ -3,13 +3,15 @@ package fr.iut_fbleau.info.but3.automation.rock_paper_scissors.play.domain;
|
||||
public enum Move {
|
||||
ROCK,
|
||||
PAPER,
|
||||
SCISSORS;
|
||||
SCISSORS,
|
||||
PUIT;
|
||||
|
||||
public boolean beats(Move other) {
|
||||
return switch (this) {
|
||||
case ROCK -> other == SCISSORS;
|
||||
case PAPER -> other == ROCK;
|
||||
case PAPER -> other == ROCK || other == PUIT;
|
||||
case SCISSORS -> other == PAPER;
|
||||
case PUIT -> other == SCISSORS || other == ROCK;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user