5 Commits

Author SHA1 Message Date
a048172f76 Merge pull request 'rps1.2' (#1) from rps1.2 into main
All checks were successful
rock-paper-scissors/pipeline/head This commit looks good
Reviewed-on: #1
2025-11-27 11:59:37 +01:00
vaisse
710d3617ad maj puit. corrs 2
Some checks are pending
rock-paper-scissors/pipeline/head This commit looks good
rock-paper-scissors/pipeline/pr-main Build started...
2025-11-27 11:56:14 +01:00
vaisse
2b9fa81cc2 maj puit. corrs 1
Some checks failed
rock-paper-scissors/pipeline/head There was a failure building this commit
2025-11-27 11:47:20 +01:00
vaisse
1c498a61d3 ajout du puit
Some checks failed
rock-paper-scissors/pipeline/head There was a failure building this commit
2025-11-27 11:35:59 +01:00
9b1af5029f Merge pull request 'update-code' (#6) from update-code into main
All checks were successful
rock-paper-scissors/pipeline/head This commit looks good
Reviewed-on: pierront/rock-paper-scissors#6
2025-11-26 17:06:38 +01:00
3 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 PAPER -> other == ROCK;
case PAPER -> (other == ROCK) || (other == WELL);
case SCISSORS -> other == PAPER;
case WELL -> (other==ROCK) || (other==SCISSORS);
};
}
}

View File

@@ -14,7 +14,7 @@ class MoveTest {
@Test
void should_check_move_size(){
Assertions.assertEquals(3, Move.values().length);
Assertions.assertEquals(4, Move.values().length);
}
@ParameterizedTest(name = "{0} should beat {1}")
@@ -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.SCISSORS,Move.PAPER),
Arguments.of(Move.WELL,Move.SCISSORS),
Arguments.of(Move.WELL,Move.ROCK),
Arguments.of(Move.PAPER,Move.WELL)
);
}
}

View File

@@ -20,9 +20,10 @@ class RandomCpuPickerTest {
obtainedMoves.add(picker.pick());
}
assertEquals(3, obtainedMoves.size());
assertEquals(4, obtainedMoves.size());
assertTrue(obtainedMoves.contains(Move.ROCK));
assertTrue(obtainedMoves.contains(Move.PAPER));
assertTrue(obtainedMoves.contains(Move.SCISSORS));
assertTrue(obtainedMoves.contains(Move.WELL));
}
}