mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-07-23 08:20:28 +02:00
Legger til tester for RoboRallyGame og legger til noen begrensinger
Begrenser prioritet på programmeringskort til prioriteter brukt i brettspillet Begrenser programmet spillet mellomlagrer til et program med nøyaktig 5 kort Fikser prioriteter brukt i tester
This commit is contained in:
@@ -17,6 +17,9 @@ public class ProgrammingCard implements Comparable<ProgrammingCard> {
|
||||
* @param cardAction the action of the card
|
||||
*/
|
||||
public ProgrammingCard(int cardPriority, Action cardAction) {
|
||||
if (cardPriority < 10 || cardPriority > 840 || cardPriority % 10 != 0) {
|
||||
throw new IllegalArgumentException("You cannot create a programming card not part of the original game.");
|
||||
}
|
||||
this.cardPriority = cardPriority;
|
||||
this.cardAction = cardAction;
|
||||
}
|
||||
|
@@ -131,6 +131,9 @@ public class RoboRallyGame implements DrawableGame, InteractableGame {
|
||||
|
||||
@Override
|
||||
public void setProgram(List<ProgrammingCard> program) {
|
||||
if (program.size() != 5) {
|
||||
throw new IllegalArgumentException("Invalid program chosen.");
|
||||
}
|
||||
this.program = program;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user