implemented makeDeck method
This commit is contained in:
Binary file not shown.
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user