forked from pierront/rock-paper-scissors
ajout puit
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,
|
||||
WELL;
|
||||
|
||||
public boolean beats(Move other) {
|
||||
return switch (this) {
|
||||
case ROCK -> other == SCISSORS;
|
||||
case ROCK -> other == SCISSORS || other == WELL;
|
||||
case PAPER -> other == ROCK;
|
||||
case SCISSORS -> other == PAPER;
|
||||
case SCISSORS -> other == PAPER || other == WELL;
|
||||
case WELL -> other == PAPER;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,9 @@ public class PlayControllerTest {
|
||||
public static Stream<Arguments> scenario() {
|
||||
return Stream.of(
|
||||
Arguments.of(Move.ROCK, Move.SCISSORS, WIN),
|
||||
Arguments.of(Move.ROCK, Move.PAPER, LOOSE)
|
||||
Arguments.of(Move.ROCK, Move.PAPER, LOOSE),
|
||||
Arguments.of(Move.WELL, Move.PAPER, LOOSE),
|
||||
Arguments.of(Move.ROCK, Move.WELL, WIN)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,5 +24,6 @@ class RandomCpuPickerTest {
|
||||
assertTrue(obtainedMoves.contains(Move.ROCK));
|
||||
assertTrue(obtainedMoves.contains(Move.PAPER));
|
||||
assertTrue(obtainedMoves.contains(Move.SCISSORS));
|
||||
assertTrue(obtainedMoves.contains(Move.WELL));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user