forked from pierront/rock-paper-scissors
Fix: Add Well for the game
This commit is contained in:
@@ -3,13 +3,17 @@ package fr.iut_fbleau.info.but3.automation.rock_paper_scissors.play.domain;
|
||||
public enum Move {
|
||||
ROCK,
|
||||
PAPER,
|
||||
SCISSORS;
|
||||
SCISSORS,
|
||||
WELL;
|
||||
|
||||
public boolean beats(Move other) {
|
||||
return switch (this) {
|
||||
case ROCK -> other == SCISSORS;
|
||||
case PAPER -> other == ROCK;
|
||||
case PAPER -> (other == ROCK || other == WELL);
|
||||
case SCISSORS -> other == PAPER;
|
||||
case WELL -> (other == ROCK || other == SCISSORS);
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,10 @@ class MoveTest {
|
||||
return Stream.of(
|
||||
Arguments.of(Move.ROCK,Move.SCISSORS),
|
||||
Arguments.of(Move.PAPER,Move.ROCK),
|
||||
Arguments.of(Move.SCISSORS,Move.PAPER)
|
||||
Arguments.of(Move.PAPER,Move.WELL),
|
||||
Arguments.of(Move.SCISSORS,Move.PAPER),
|
||||
Arguments.of(Move.WELL,Move.ROCK),
|
||||
Arguments.of(Move.WELL,Move.SCISSORS)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user