From 02d30a8a069da68f9c5499ceea6703033720ff38 Mon Sep 17 00:00:00 2001 From: fdai7906 Date: Wed, 31 Jan 2024 13:22:30 +0100 Subject: [PATCH] add fillDrawDeck --- .../de/hsfulda/onses/services/GameService.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/java/de/hsfulda/onses/services/GameService.java b/src/main/java/de/hsfulda/onses/services/GameService.java index bdee4d5..d1a440d 100644 --- a/src/main/java/de/hsfulda/onses/services/GameService.java +++ b/src/main/java/de/hsfulda/onses/services/GameService.java @@ -4,6 +4,8 @@ import de.hsfulda.onses.models.Card; import de.hsfulda.onses.models.Game; import de.hsfulda.onses.models.Player; +import java.util.Collections; + public class GameService { private final Game game; public GameService(Game game) { @@ -34,4 +36,20 @@ public class GameService { return legalMoveFound; } + public void fillDrawDeck() { + for (Card.Color i : Card.Color.values()){ + for (Card.Value j : Card.Value.values()){ + if (i != Card.Color.BLACK && j != Card.Value.CHOOSE && j != Card.Value.CHOOSEDRAW){ + game.addCardToDrawCardDeck(new Card().setColor(i).setValue(j)); + game.addCardToDrawCardDeck(new Card().setColor(i).setValue(j)); + } + } + } + + for (int i = 0; i != 4; i++){ + game.addCardToDrawCardDeck(new Card().setColor(Card.Color.BLACK).setValue(Card.Value.CHOOSE)); + game.addCardToDrawCardDeck(new Card().setColor(Card.Color.BLACK).setValue(Card.Value.CHOOSEDRAW)); + } + } + }