forked from pierront/rock-paper-scissors
Updated well
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
This commit is contained in:
@@ -8,10 +8,10 @@ public enum Move {
|
|||||||
|
|
||||||
public boolean beats(Move other) {
|
public boolean beats(Move other) {
|
||||||
return switch (this) {
|
return switch (this) {
|
||||||
case ROCK -> (other == SCISSORS || other == WELL);
|
case ROCK -> other == SCISSORS;
|
||||||
case PAPER -> other == ROCK;
|
case PAPER -> (other == ROCK || other == WELL);
|
||||||
case SCISSORS -> (other == PAPER || other == WELL);
|
case SCISSORS -> other == PAPER;
|
||||||
case WELL -> other == PAPER;
|
case WELL -> (other == ROCK || other == SCISSORS);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,9 +46,7 @@ public class PlayControllerTest {
|
|||||||
public static Stream<Arguments> scenario() {
|
public static Stream<Arguments> scenario() {
|
||||||
return Stream.of(
|
return Stream.of(
|
||||||
Arguments.of(Move.ROCK, Move.SCISSORS, WIN),
|
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.WELL, Move.ROCK, WIN)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user