From 0911f7b2b99df8e4abd3645aefcff94bb087371b Mon Sep 17 00:00:00 2001 From: peet Date: Sun, 12 May 2024 15:13:55 +0200 Subject: [PATCH] implemented makeDeck method --- bin/cards/maumau/MauMauDeck.class | Bin 443 -> 1354 bytes src/cards/maumau/MauMauDeck.java | 21 +++++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/bin/cards/maumau/MauMauDeck.class b/bin/cards/maumau/MauMauDeck.class index aef60b8e71dc969436fa0d1ba823168ef09e865a..95dbfa5ccc5e1978c501315cbc331669a1273fc1 100644 GIT binary patch literal 1354 zcmZ`(QBxCF6#j0q;ck{i5C}G+C|YYGg-~i!Opul$)YJeiK`iy9mt@tIkT^+}8D1P8 z7{>?4zu@qY;Z^$rtuy?9{--wm?j|LG<78*gz27H$E>qSSPH(SoD;;O2+dfx(#+7q`b5Y2w#`m}(#sWu#)ia=j1 z6VLj&cr~|}$hy@U1Hw7?aY@y@3NIP{IAW^BJ<9^q(`ku5617QYDiyV@nJn}oY+(SO zNt_d~ni(yt(uR#F&a>n#RrDNY+Z~HPY>{er+QJ14NnAWSl=Ix0K6L3stVYveUNCIq z3a(PRl?O`#_HiohzGmYK?GCNnU7nlMNX$lDBgXvF{bdb|*!Z#uWLEu%F&hb=GMD*P z;;W-fbkP>Z@wINtO@YDK@!MK!Ke6~~Cz6z?0EP0!{)f8D|SZ~2^ zd(X!`7cRXOiceFeu5B6pVgv?GPTTgg|0izf6xpfq5a`O)RDNSYJ@ZFYVu8?!c1y5p zM^NiND_8a^d1v0$#dWv8pD`^5hC%uGwE+SC_B*G)1j(qb0y=(jE&jxSrVfz4)wN%GpG89Z2d-y%t5iuqf z4=}ivvJR8sVA9;fOw@{)6Dc|R2QJq!PV;#kahmIOT%oy9#~{sU9sMI8Fupb#mHU|Z z6W;{zV8;{@GZNly9PSt*Vnjl_jkh}iapC-K;W~>m;Lp z#9eBUVXW4x8UGVk_lVqw{0ChUNztHsQs@-~O%`aNADuoTG0?>Hdl5(l8dUpqbQrt^1%nO) nPz0!wiE#snWZ(jlY+w-y25umm2O`TL#2^ghF*1mNRfz%sYd{XK diff --git a/src/cards/maumau/MauMauDeck.java b/src/cards/maumau/MauMauDeck.java index 9595b17..bbe293c 100644 --- a/src/cards/maumau/MauMauDeck.java +++ b/src/cards/maumau/MauMauDeck.java @@ -1,7 +1,11 @@ package cards.maumau; import cards.Card; +import cards.Rank; +import cards.Suit; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -20,7 +24,20 @@ public class MauMauDeck { * @return A list containing the generated deck of cards. */ public static List makeDeck(int numDecks) { - //TODO implement - return null; + List deck = new ArrayList<>(); + + 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; } }