Added the well
Some checks failed
rock-paper-scissors/pipeline/head There was a failure building this commit

This commit is contained in:
glee.mcbean
2025-11-27 11:00:15 +01:00
parent 9b1af5029f
commit 8d832e8e92
4 changed files with 11 additions and 5 deletions

View File

@@ -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;
};
}
}

View File

@@ -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.WELL, Move.ROCK, WIN)
);
}

View File

@@ -33,7 +33,8 @@ 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.SCISSORS,Move.PAPER),
Arguments.of(Move.WELL,Move.ROCK)
);
}
}

View File

@@ -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));
}
}