implemented makeDeck method

This commit is contained in:
Johannes Schmelz 2024-05-12 15:13:55 +02:00
parent 4b03f5d629
commit 0911f7b2b9
2 changed files with 19 additions and 2 deletions

Binary file not shown.

View File

@ -1,7 +1,11 @@
package cards.maumau; package cards.maumau;
import cards.Card; import cards.Card;
import cards.Rank;
import cards.Suit;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
/** /**
@ -20,7 +24,20 @@ public class MauMauDeck {
* @return A list containing the generated deck of cards. * @return A list containing the generated deck of cards.
*/ */
public static List<Card> makeDeck(int numDecks) { public static List<Card> makeDeck(int numDecks) {
//TODO implement List<Card> deck = new ArrayList<>();
return null;
for(int i = 0; i < numDecks; i++){
for(Rank rank : Rank.values()) {
for(Suit suit : Suit.values()) {
if(rank != Rank.TWO && rank != Rank.THREE && rank != Rank.FOUR && rank != Rank.FIVE && rank != Rank.SIX) {
deck.add(new Card(rank,suit));
}
}
}
}
Collections.shuffle(deck);
return deck;
} }
} }