From a3161603e57aa4c6970ad23a51a2a502d4e58a5b Mon Sep 17 00:00:00 2001 From: peet Date: Sun, 12 May 2024 14:25:54 +0200 Subject: [PATCH] initial commit --- .vscode/settings.json | 7 + README.md | 18 + bin/cards/Card.class | Bin 0 -> 2064 bytes bin/cards/Rank.class | Bin 0 -> 1531 bytes bin/cards/Suit.class | Bin 0 -> 1130 bytes bin/cards/maumau/MauMauDeck.class | Bin 0 -> 443 bytes bin/cards/maumau/MauMauGame.class | Bin 0 -> 2702 bytes bin/cards/maumau/gui/CardListRenderer.class | Bin 0 -> 1596 bytes bin/cards/maumau/gui/GameTableModel.class | Bin 0 -> 1768 bytes bin/cards/maumau/gui/PlayerFrame.class | Bin 0 -> 8914 bytes bin/cards/maumau/model/ActionHandler.class | Bin 0 -> 1953 bytes bin/cards/maumau/model/CardHandler.class | Bin 0 -> 2181 bytes bin/cards/maumau/model/GameState.class | Bin 0 -> 1217 bytes bin/cards/maumau/model/IObserver.class | Bin 0 -> 183 bytes bin/cards/maumau/model/MauMau.class | Bin 0 -> 6515 bytes bin/cards/maumau/model/Player.class | Bin 0 -> 4784 bytes bin/cards/maumau/model/PlayerHandler.class | Bin 0 -> 1757 bytes src/cards/Card.java | 29 + src/cards/Rank.java | 19 + src/cards/Suit.java | 34 ++ src/cards/maumau/MauMauDeck.java | 26 + src/cards/maumau/MauMauGame.java | 82 +++ src/cards/maumau/gui/CardListRenderer.java | 49 ++ src/cards/maumau/gui/GameTableModel.java | 67 +++ src/cards/maumau/gui/PlayerFrame.java | 231 ++++++++ src/cards/maumau/model/ActionHandler.java | 153 +++++ src/cards/maumau/model/CardHandler.java | 96 +++ src/cards/maumau/model/GameState.java | 29 + src/cards/maumau/model/IObserver.java | 18 + src/cards/maumau/model/MauMau.java | 227 ++++++++ src/cards/maumau/model/Player.java | 174 ++++++ src/cards/maumau/model/PlayerHandler.java | 106 ++++ test/cards/CardTest.java | 25 + test/cards/RankTest.java | 37 ++ test/cards/SuitTest.java | 19 + test/cards/maumau/MauMauDeckTest.java | 34 ++ test/cards/maumau/model/CardHandlerTest.java | 43 ++ test/cards/maumau/model/MauMau1Test.java | 181 ++++++ test/cards/maumau/model/MauMau2Test.java | 246 ++++++++ test/cards/maumau/model/MauMau3Test.java | 173 ++++++ test/cards/maumau/model/MauMau4Test.java | 368 ++++++++++++ test/cards/maumau/model/MauMau5Test.java | 533 +++++++++++++++++ test/cards/maumau/model/MauMau6Test.java | 578 +++++++++++++++++++ test/cards/maumau/model/MauMau7Test.java | 302 ++++++++++ test/cards/maumau/model/MauMau8Test.java | 463 +++++++++++++++ test/cards/maumau/model/MauMau9Test.java | 403 +++++++++++++ 46 files changed, 4770 insertions(+) create mode 100644 .vscode/settings.json create mode 100644 README.md create mode 100644 bin/cards/Card.class create mode 100644 bin/cards/Rank.class create mode 100644 bin/cards/Suit.class create mode 100644 bin/cards/maumau/MauMauDeck.class create mode 100644 bin/cards/maumau/MauMauGame.class create mode 100644 bin/cards/maumau/gui/CardListRenderer.class create mode 100644 bin/cards/maumau/gui/GameTableModel.class create mode 100644 bin/cards/maumau/gui/PlayerFrame.class create mode 100644 bin/cards/maumau/model/ActionHandler.class create mode 100644 bin/cards/maumau/model/CardHandler.class create mode 100644 bin/cards/maumau/model/GameState.class create mode 100644 bin/cards/maumau/model/IObserver.class create mode 100644 bin/cards/maumau/model/MauMau.class create mode 100644 bin/cards/maumau/model/Player.class create mode 100644 bin/cards/maumau/model/PlayerHandler.class create mode 100644 src/cards/Card.java create mode 100644 src/cards/Rank.java create mode 100644 src/cards/Suit.java create mode 100644 src/cards/maumau/MauMauDeck.java create mode 100644 src/cards/maumau/MauMauGame.java create mode 100644 src/cards/maumau/gui/CardListRenderer.java create mode 100644 src/cards/maumau/gui/GameTableModel.java create mode 100644 src/cards/maumau/gui/PlayerFrame.java create mode 100644 src/cards/maumau/model/ActionHandler.java create mode 100644 src/cards/maumau/model/CardHandler.java create mode 100644 src/cards/maumau/model/GameState.java create mode 100644 src/cards/maumau/model/IObserver.java create mode 100644 src/cards/maumau/model/MauMau.java create mode 100644 src/cards/maumau/model/Player.java create mode 100644 src/cards/maumau/model/PlayerHandler.java create mode 100644 test/cards/CardTest.java create mode 100644 test/cards/RankTest.java create mode 100644 test/cards/SuitTest.java create mode 100644 test/cards/maumau/MauMauDeckTest.java create mode 100644 test/cards/maumau/model/CardHandlerTest.java create mode 100644 test/cards/maumau/model/MauMau1Test.java create mode 100644 test/cards/maumau/model/MauMau2Test.java create mode 100644 test/cards/maumau/model/MauMau3Test.java create mode 100644 test/cards/maumau/model/MauMau4Test.java create mode 100644 test/cards/maumau/model/MauMau5Test.java create mode 100644 test/cards/maumau/model/MauMau6Test.java create mode 100644 test/cards/maumau/model/MauMau7Test.java create mode 100644 test/cards/maumau/model/MauMau8Test.java create mode 100644 test/cards/maumau/model/MauMau9Test.java diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..e112a70 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "java.project.sourcePaths": ["src"], + "java.project.outputPath": "bin", + "java.project.referencedLibraries": [ + "lib/**/*.jar" + ] +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..7c03a53 --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +## Getting Started + +Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code. + +## Folder Structure + +The workspace contains two folders by default, where: + +- `src`: the folder to maintain sources +- `lib`: the folder to maintain dependencies + +Meanwhile, the compiled output files will be generated in the `bin` folder by default. + +> If you want to customize the folder structure, open `.vscode/settings.json` and update the related settings there. + +## Dependency Management + +The `JAVA PROJECTS` view allows you to manage your dependencies. More details can be found [here](https://github.com/microsoft/vscode-java-dependency#manage-dependencies). diff --git a/bin/cards/Card.class b/bin/cards/Card.class new file mode 100644 index 0000000000000000000000000000000000000000..41dcbd5226796d77c67b411f3b43de4619aba86e GIT binary patch literal 2064 zcmb_c+j84f6kW$oBHI;l?4&Ia=mnD2c1q1P6dY1omr#S#lsKeNo=)sTtj3mtBxk07 z!bk8xXJ}#a!0^mRF{~pU$8vD`#AtLbTl==w-r9fvbNnZOJ9um%C6H@NzY|pJTrErq z%sr7uvf7jGesx>5JuRIPSQts`UjI<~a<8WZrhMrh2-wZo$u@5_N`rwDj-)N#D4khz zTqj%?SS%&g%{fvk@6x#LbyN;%@m&r$ux(UA8XZB8z10f zfvaN~Bp{q*AkLZ zd#@Sb5hv@qW$t=j7=*q&jC&`@@h_@dxGS(UY8J;m@(xrrrams(hHQtP|5R7=p1{vZ zGK_ZY@V<0AJryi9J?~&}n9S^}r}<7Jg`%E$oCHNZ@wjIwKL?v%Ug2$%dzyQ`@;hcLE6-7= z+<1=pXB4Gyp6d+N^?HHpl~@%Q@hWdLid^gO`N(++ukoBsQOu36(36d;j{#D~6Z-!&zE-)Xv`zY#Q(Gf>wHcp5aZP$SWn!XU^0KUNr9v5U1M_HptdTSHp7Qg5Lxr1GN#{z%P`z$r%u8MlM$Odb)>5I|U7HBLcnpy?ZAZ`*G0&Ny(*Qzrcijhjd;iWVA zuj=+gIy!dz+&{|koC7vnJAUE0zkAQwbN8HQdG+`2F9DSBqk%aEtL+aTkMak8{}%&M zh13)Osh{up{iD3opByVh8V~9Ux_TB@P>3~l4;)7!x?OJ`uvA(^5x4S?&RnPE)JUDm z&TfMaYn2)wHh437w^ZJvv-?d)aIaF^p|et%B9cz6xqr1)sx}>0VgAvZB@@MVuiNjA zHz_=mZPBC3gU6i&VipvZH7?+yLcBN&S;|z;Uc?;_yZxg=CEGG7_OeC{@dONp4>b&i z1jAL01cS+NUBhIs7;+jGLz3YWjU~$2<)j`|uwfte1SvD<1uuL5p z|J)rZB*ug38!Md4WZ&)sM^`l}xJwOt>h~rcN?OQd-)OjndpIy~U%?JF@?wCh&MSs*v02z! zqme}Dvq^28XZHZ4WE@fQj40Vfl$;_;CJ`lnh>|r#$rYkx2vPEaDA_=i901tMJb$Vf zBTv4IC93}(pw-dAH@W&2z(qDxF(P>1hN7*5(29N zH|=R$UTDpp2CfTzZcigOgubv%$-6D|m2C+Xgub?uLYqQcwiYVc^MBHfBLObCUNpdp z>%{_GalLqeYp!Pm$hux4z^d!nw3R2Jy>$}W+#oRn+$OOC6iAW*Hc51VlKULx->4;X zaOl?}1x@A|^>ABu`Go!(rv1YjO_AqlO+$tLzun-(GJ h|JLjoIjYDPu+l2`0uTOz`v1H+d?z=2gzrUv_y+=j8RWbsoO6-&lux{ieZ;SbUA z0iu!k*&k&*_pY*vF-v;Rb9bI|p7Zka*Viimc|2Fq$Dr42@357z+ODr6!Z3JjpW2za z-8jk=8toGX8_-*X#B*`0Jnqu5&p zWGGRn9NadbauDTU!a$S*je}_e8Wir$8qm?t5G%S3r`$d{aJ)VHpzbili_Mx{uh^c; zv3S%WVVK1EAKVtT>o>c_8Aem-e?+ONI(E$evSExVUp=vHpUf^CYsX_q=NQUrLN=U7e zPd60MGh}(3Y+hjDGdW#FUGl7`*d@yWSwk9TKwhV5@!E+FW~#3x^QxNTEtjN;ODrzk l%*L+uYt+%BAcsj6xd1)R%u77}0rr1hAJ&D!CwMCCv)}%<&z}GQ literal 0 HcmV?d00001 diff --git a/bin/cards/maumau/MauMauDeck.class b/bin/cards/maumau/MauMauDeck.class new file mode 100644 index 0000000000000000000000000000000000000000..aef60b8e71dc969436fa0d1ba823168ef09e865a GIT binary patch literal 443 zcmZ`#+e*Vg5IvJ#(!^?N>-Dj3t%&)6mV#7-Lez&!-#6(}x6K8TtlycJ|C1&dk}*ulElC*Eq3Z5l$nKFAF~rn!~>nn&U=B8yj^(XDyzEAB%M5KZI); zm4xP4rK+3|YJ=f|P@iT?>7oXwjRu+oFHotx*GVYzM-j%7&<(Ok#0!xtgSW+c`J@WM zdGOEp5uufcjWnwedV|?8sCLn%iv2(pB@>*vTBV}YIS=XoWsJAlQ#Lr77{OF0Mvv#x zjNr~Qok#LknI*lQ^D8q5eXvFTC&1#v))?E2e9pwVaq))MYt?r7Hf`VldwjQl2%PsB kIb8KvqQh?shn2|XR>Y#0s=8A+`=wx^iyrq0M-}V%8&wNg8UO$Q literal 0 HcmV?d00001 diff --git a/bin/cards/maumau/MauMauGame.class b/bin/cards/maumau/MauMauGame.class new file mode 100644 index 0000000000000000000000000000000000000000..9719deaa6f44d95f1b0b973bb20dab4ece83d46c GIT binary patch literal 2702 zcmaJ@TU!%X6kR7I41`f2AQlCUw;BP7SXwQCD55ADgcgexTiZi84I{ZZGf`-5wfCF9 zz_<3rXZwIyzt6AF{T+SlZ>V;inTddn3o42_G@6K@ zUZ6Q+71hN`VP4sn@Hf4KxgI^>Qe%diX(HX5iN)rXx&6+ zX2o$;!9*L{NkrMUz_yIX)hZ>YZL8?cxVDmoR0BE$j(I>s@!@@*vUpk9@p4|SC_Bx) z1(jWLI4RQTfnYqEj`#QXNAVhV80ZvetATA|C%OcTvR0Qbl0m|!;JJ(Xtzs^9Xtn{n z1P0=_7L~1PGDwfakH%$jVVw$h2BI`OZekDi(#LAqqUXbj3D4sNX;E88;%Y5*Q3$+l z;-C)2)`DD8GghITS308l=#YsX>}Qnp(OFegw#@4@qDwo+fV9;>71%Q4%IwmlEPK(5 zB8dS5M`|a}Y5LQ|QM@70pta~VaY^3iTXC&?GGjSz%D|hdUo!0c?43k%a;j0KXl0<$^se7(K^ljbDjI<_c_ zuFPw%oiZ_o)67W6l{O=>D^W|@uN{V*&eTc8jD49iPja5Ocm59mW4pOxR?5|?+4U0O zZ~!yL8cwBCnrp_yR@6sv5z_{ys#W7Teblz)ieus(yvsV4jt+vrflZ0zmwD@Hjizu47jQ1I8%VjRPC01fbVx#m#u%Bwe96m5`l@G!?LiN;U z7o~I2BfDyg@E_bkg)ypDu=5CYJR>(CFo@{{{@= zQxl)zHY+EmT%Qp+#HucT5m^>x;9mBu3{zq!*SbtaPHtMUBF+zs$~4j zESV_o;9C>l;d}COlsjuVme)MOi8)wG`Ivbqlt6Vzrb+|S5aMJf$%7A>%VQkp*gl~ z72EaL%`v=&-Rod6g!Lt`A@OD3j&}AI4XlM5u@CzLxM_}>OH0qw`)FLlfd?>p){xLh zbsjArDNg=-h_H_Y_iv!sf?o9T?qPnz2sLRLHiH2Dw%+5(UXts-@C1Wb8ff!dncmpj zt4Lk$jh*m@HH@z7+d*ltYeb0LOzaL~ccY)$lb+rVB1X7#2IIWf%$|G}=csRjEA2M_ z>^xUd-Fti{B1gMM)*weVF4A3*U(nDU_653W z!%$co(bXBI6+@8+h;>F@2zaJEMo!@V^S?VIG>X2Qq^5`D(1tupSRxA@>NI%+#~6v@ zJQ+e9DOx$q*$7VZG=meE;_Mp79RGF7;}oUGP{wIEv|C5=oR>>(;QuyA6i}q5IHgOx z86x5d+~BN^NPV8a!aR$6{)%|}Hqkf|5jS;b9$S3F-&K0s$*;O@^ePjKf-?<0H} zUd1=u^*s02dM0!*mSAHE(-%82O&(J?!fv9i*L(@?*#e%L_yIpswdUK3&~yIOktC_i N=`s-bi3cJ4{4ZHNZG!*+ literal 0 HcmV?d00001 diff --git a/bin/cards/maumau/gui/CardListRenderer.class b/bin/cards/maumau/gui/CardListRenderer.class new file mode 100644 index 0000000000000000000000000000000000000000..46c36225b7bc60f9fdd955e156d4029d124e26b1 GIT binary patch literal 1596 zcmb7EU3U{z6x}zOW|}xHP)H>ODp)^~X$^nSt^* zeCsdpRaqL=^1-FA{v;m6eJ5#2X>~2v%4F_6_ndS0*=L{m>+j!w2XGtTn#c%Tab?u$ zIXg1p&*>(fQ>UTf_2QNaIx13;2}5A+k$fWeoZeF}=sGLvJDK>gcB(7iKX4St?fUYW ziUck+j-=fQJIZ$+riV4UEqZ|$FA2<+|HH4cDPYtYSwI$VSukM>aw z+!!U}o~EIenjBw}o#yr<<;J!3t*y$yDxb#AVLbEa+g>-2aS{>j?GutM+Drcjr=6H9 z@|s33@VSLA@Fo4(=~4fw18QCe6nI_D!lHK1b!7Bd%iHkTbEZE*2t@uw`bjFpw6IZ4 z@X+H>?Foo=w#w_Zl~1iGLKRyAmdk0nD|>69n^3L7WwS=hA4-rCGBoiF80tCYRABn3 z^q=h>$bb4cP%SbN(2hyheYu;?i3t*Z=9sumJY*l47)SV2V4&rCG_L9t@rpY0J=yxrM{~#<_3W^VLg5qd4{gZ!hGkf1VV}bip?kA=+paIUZ5TJ|+ zR0z+;9OfyYD!;i`(SVZzZVezD0&e0amI#-y@D*;Q%>1tDG_1NnykU9U?Y(@v>v)P;Q3k!OV;VDD?d-PqwoT^&1yieE#*jihB=k}2L?&C3>Kk3pZW<-Kma(d{^(pd*EL*ldhi-eX=+v#p0;0&ht0^_q zjD~e~fJ$h$jf%y-YT8d^Z%KVW)ltMP0i9U#)KFQE{hucPWA?b`u@XfIn;OajGjH;0(UAJbf+f7nDHF(IEWQ9nx zfy4YX2>c+=7e~V!YZ&1(N^2b<{(;!S@4V0dhSBG=LO8+an2MZ4goh@Iw{VhkN#7ge zn4rZtg(^5Y1wFuA=3CATEgT~83NEHXX9<^5P|}@F0hC~ZsQ}=s0AP*)r+>uBg&ywWoCzuNooL9agLF~m|ro|vrXy|~;e%VqWAlnBK z>T!G@OI)RJB2I59?7q+O`pi!>_`B-A6vhWfQqycpCu7&rg=>N<<9lVof_OR34E9CA$g_Rov-!EtCisOM^Xd|V z;b?E&S|46Ema;$A?MCWa)^{e{_;xogC>t<*1hZO4iSQ6TA@za^4{ejv8FAZ`hhXk# z0@Z0XmC2!yY@+gP4JVR5&Ft2EEt}jPClyI%*GW*`9`21g$yD4G)E*Fdxi7wv66#MP zX&@s@Fl7|wS`|Qqx#OYZnApkKfO2egI(3f+k0DVgIRz6*C+Ye)B?C^B+KxfpK%kadptX?;{js~ab>V-zn zx`;#Hw2bDvxUPM9tUzr5c6?_^7w?HxO(B{atIdMm;l>C zNN`X-t+8?tHCUtsM+#xVeVd3bpp=-<uq=qhn5)v4 z+Ni{o08S80=;h|C=!tkTp-c5P4#pGatZ>7leaQK#39*L%7*+n9=JDs;6C3jy_7i;cB7#dC}1f#5K@ zrGOLLoD~1nTWAx^8MQt>g@S0sdR1z}{sPG7=IOQ3Mmd5(>b1$nY3jAI)Ic{wRY9lQ zI730U24vWYgm=29wFI#RpR{mh;dt|y+xQgDqP?B&?p)oNTQHong@uL^Ol}QF-F2z{ zPB(6<0v*#D>vAHSop@Lai4QDE_JtGN-)Livsc}rD5_R}~3YBjL-Di)DUi1kjF+Un( z(WDzqY6Q^xnKV(i>WV}4;&jATW=J+N8e;KoH=YTMum(myViux)Sefw2Qrj5NfGJP7 zNslA|Evk(a>c*8aX(NU0Odnd0$&(jYjj{fLSd@tMdC9rHbF15xr1dPE$E{|y^5d0q z6UjLBP9}mF#1ZBE__U4lae<(;moZHuX;J7!Ha?Su?oh}jHZE02Q1SZQaBp8y!I#_k zEI!A$9W)?i(4_Fs+qg0hZdhDx;|t27q$eDSDAKhyzG$R`2b}Kn6mp%7FJ~b;EZo2_ z$nK&gN;^^W>v59?_05!8-NGM@-a*`I<14t0)(aan))&t(>MoCxMeTOnVc}~GS7n;1 zEuPO-IbF$Ee20xY@pZu=U2#{7bZpR#yWI`$b~oaod5M`%-f3K3=Pgr44eqva5AOB+ znxSF=-#?K$>^`=barxY+&4m4DqZ?&dX-o{^8@l;JRL-|-d>aqYM6^qz8;NAF$Z51R zWs#4-2+@LNJovDUN7Ury>e#_>ce2mIV`Gb;$+aLJMOuZAj1!R5gsd}IrdJyQkK*nC z_AvFk`eLz!Yie;Nr;^8QdGHL=pW#hZ}9s{-C+2%H+lF1lzZ;hWh`7JIN9tC-MvNAEU*5gzkz&-|WVq18i zlCmBT;yJuv;dzSleAk`|GiP7KOAN&AP9){BG)=Bvc&1;SbeUQ{hwt0?fwtj5GUj#M zN)+LTYM56Ar+kbV@|k^{NdkDCzU_0iyH(Lx)zV7#^~VEvg9$&6Rc~G;O7#7w#L@Rf z9;{S%CV1P%J6iKOqjYUkKj!KO(;#QR@#Tf}w$#MLxXH%Eh?e67O~H1OzZXt??MaGi za|R5Wh2Ii1%61n1g#%iCCi$KT;(g53k3ZP>BmR}?&yqPhJOuOd3TR=c>m-$Q&!c9Q z-v06 zoZ8(8YrWgO*+iM90Cmpvs8li>sZ&_}1bl%1weTT3np&+cyJF)X_(=W0PHyJ27NUyS zQY6LPC?%{4$Cc^m`Ot4MmXu~=UiIe;BbJT-l7Pm$?^Io&=E^r{%LMX<6;3qw4RxWz*YJIu2$ckD^mGF0JVW=+L#oi=*(*fEe9KfE(Z&a7k3 z1UiCk(mfn%%VC;Jlf02iO{4zNr8%}#=~AV)v?=clq094ZnXk(g-ZC@9KRoE-0$YyI z#e=*>uiG@nA~Cj#`BH7mLR~HGintCTvm|6otwxagS9M6JbB?s7PL5*0ayoFGew|?b zvSLi&LG@(7#rg?yv>a>6F@ov2fEtBj%W)pJSe)@0l%;ZlCC76E2Hzx<7e%%#6WZ43 z5^)kNl~Xc;4OXK9>nl+vC)#q7a0D-Ny1Lu}2IYyP8{D|FV7~r6siJwD?8E7^=o=AJ<7HPI+l^Rgz!=`Yei#FU4j<^9?!ve_)n>lm@ zWv#SY!jV32+cY7=(v~(^N5Q5)tnU#V;S0_)O})Q?{PI%?OE%bYs%)g~wYzaYT~6}! zaI()#b`IydG0Z%Hg_!Y7B%5qGP4mj){IJOsy^;a$MYnl|EgiCj^_kn$^N5K$HBrGs zNfx8NTs|phS@NmEHwRffTh5kqSld^xY->Kdapk(k=GNw>aYMX!Y|RqY2c%PJ^x)Rz zM7vlmx>a7c&GaU>a>H%?=H`t7>D5<7jPagAHx#yItJb>-+|bg-SV|}CN(3aL24%=k zt!^n`a;1#fG9c$tu%=8O2brjLaYjJa7N)CLqFgqpI!Rkns?LPQHS5>6H=o^pS_><{ z78$hVJYnIhP(G=6oMqj+AldI(&%Zwj$fqftqIHO3Wux?faAK3Ha=Az@w&XLJ;_e+y znEbX}B9}7nS8r@?W~liEExSxNT_l&=@>xYH-q_s4$ylzi<@0hSk^Rw^$D7RXdSqU2 zGR39dH&&*nb&i>Vm*Z|4z=IlsfLud$nzepg@$Qh$kmygn9|3@INg6C%sj|tpse}YV`evfHD^bFxkU>%A${hi&; z;fu9Ue#OQ?Xj6J!#7=2KGb_w$GN^(EW|Nr~Vck`Kfe$MPF4^+Sh?*!yGjI&HnT~@{Ml1GB+!cmc9 zaaAl@)$R4*Ds5Z=;o%@4RUE5XrP;h%qC6FvDZ))y@(00!afT@rqL%RdF#Eu$Og1l` zF&9i%{+9AC?>fED;}Mt5073JYx1C&@$mb$VBAmCD+4qC^&ihD%$ID0amp6m_t2jL5 z^K%B@eo5ZN{2Q+cr7?2^RW*AtzheXohEdJOnvR;sP(6a$Vbt+;aYyAbBRFmtOT3rk z&C4>rEbrKhlSsE>1S^NpR1+G;Dso)Y#}$mAh;9U@wrylZ95F=IS#AR#pFpcH!BMW!4i* z%8Hki4&kU7*3{CYmz5Y{GfL8Uxn@Sm9=tM&dZ((t^RiNzS~|7t&W~OR<+fzZq82d> zDqo}IAC02*w@xehC_g63PjV<_;)4*HuCVr#P z%m7@4MOckvu!h0bf)jal-hfm1*2++9<9+jb-r;V*4xEb18JJgM6Rzcj_Vw6|TW~rr z0nfl)=)i-#y-wpyJV}Zda279Q&c^Eu*moJIe_~+%4c$_L9+`w*nTIeBPFrOKBC;0! zvYt1(E@E;a2ILApUx$R;hNRqy6wCW|*~1Iieb^x{V5hu;^W|M$vHcYn$=`XedJcC~ z!+RIV2YyP-mpAcq{DKMaptLgGf5k8DT<-N<{F->bA^uDheI#cgU_mSlTD*y4YqIbj zn0`fi;pLZ#b7(hmM#Wyd-w_(Y@767 z|38zX7NUQ{zmu|@N%E9N-3)nHyOeZ^8oHj3Y^NJTG@o z#%)GhubiyNYP&)XmZ=mJ!0|ForqgzZkcXCC4>E&Vstx&_)`wVN;e*ODuJH>FerkE$ z%)h$VL#XqqX_;A*mRbCr&EL8FJv>(gXQGUFcTvZ?`8C!(EavyJ7!I*i-)A&andIYZ zR-`9>U&dLqldjcLMs->~q2@_T&2CvF*e#0%3hzkElGFFdauBql2syc)&mN%M2U&6- z%9B-_mBlLrU)KHHZxLl3WrSc&TAEtPIFJQf<9}@yah6i%h(Jph3I%BX*F?JO3`Wm`Fv! zs|`lp32J*_1*A1UwfIZ1DeF}4! zf(x01OYk(y(LNTRXIN;SMOzjWng-PB^OaVuibp{4NOoa3D$(B$QO!t$(M5B88jJFqp6 zQy{BZz$+c(#M#~FbRzi_lcHQXF(_^y%PN+~syxf8+^{MlD~|kymAY#zr|o&13Ms{d zLSarrV>#{o7*0H16z25Jv79bA5GNGN12j#MJSf^xw$QaBgzb{O^0;~WjyxsbHBaA@ zXXIJ)^qjmXFPW#8^JM!1_*YD+z@+Zvr ECwoK^EdT%j literal 0 HcmV?d00001 diff --git a/bin/cards/maumau/model/ActionHandler.class b/bin/cards/maumau/model/ActionHandler.class new file mode 100644 index 0000000000000000000000000000000000000000..f32990448613590d8b24aae760ee3a04f9f7345d GIT binary patch literal 1953 zcmah|%Wl&^6uslP4$Y%!(o&u+p-@QDM}WR4ttwR!FDX!@pi01osbd@g#4!?a9qlhIV+KXk<%fGSX!pcrLRl%!Ecu|jcYm>A_! zG)xIG8&A;?X^b*e(=wj6Tf2tyobNWFHCMHD-rV7iDb~TJ>NQN4(R9?sr;LE)VP3C4 zYw~x7(@&~@x-O(@2SH?{ML{4qU5`87LuqE>4SaAL!9wSjZZuC84I55YP%LD2;*wa( zyO`dwS8n>&1L0dABBb}yNLSWGb>Er?aM7|+iuj%p2$?Jtqx=Z#nnq-$tF$9wyu3h^ zVIf6vI>RXKo(@d{x>~W@mM2_9`B49~V<4)tn>8)nFnG zN+B+d**4AJ{=HLOygcbc8I13~P9?f+1OYaYR}5 zH6CIw%||@nPhB+0FrOt_4zduo3L1s=dil8vsf5TCS`CmZ7=@QgtT*{D66t%`K`P|8 LFQdBxMQeWnChQt; zp?>riv@?Z@&NzPdM>(GR>=HJS>5P+|?0sJDx#!+<@BaPI?|%YVLOG6z!c^IGD_*W@ zHu>bL^@`=>3f#J5)+&zW#t~CUJu{!1ImfK+;nBfD`^O3_T>?=I8R*BbLUblm ziepq^IGkZ^*Q!XK35;N<7Yb($^dceFxPd<3nl#XbZrM9$Ada3S-p0Feyra+`#_}2l z&f|hYw^^wyIS#>QLb(;{jzg{NdM%&XQWz-OHS2D(x^21l&26duV6k2{os#L=vJN(5 zjiHlnYl$IF_N?2pv zJi>%$bQkeG-LZKo(`5r6V_qR{dn?tw#=h2JE5TAO7`P(347pa*vjRw~B1oQiUNex# zB0I{ps`cmAs_lC0^WkHLq3+Me!4^xLL{8u)ZpE=g0sPIjY4XRxKmp6_cc!zXMF|S2 zaK4pAn_Jthd;+Vu6US{Tb4rM|y9U-IPx7mkE$6nL)4t7yS>9bY_q56h6md6>b%l|W zemZFv&%ixwu!i2#=94GVDMR7D(%NN8QnN1&Y)Y)IvSXR9>^v|~!b6TYTQVr&NZ=f< zpiEq}QQuQA!U}TuE0*bKO&C9zZT9Z*aLP$uoK;z(eP`f%(X5A64WcDB>rJ;z`SjOC z?gxdQlTF#YBn@-#_10)zXU#?V^s^kaZ${*4sQaOYQ|#rVFI zeT~8F9~gP`8gCt7?8HoGXAdxuojkx)_7%o19$`9yhcD?9#e4jpVtn8%Q3m)+ATNX)8;X5p78xQOwdd$Xjk@Y023|e9+=Or+MdiL+*45 zrx!FLnoPIeyr6^nAYHAXxi^BOJ3;171-XO|8A2-eW58fu7#!gvg`W}69^#YM`WK{p z`>MiUxc-8Ri9>vPh!rKl{PLx>hzm^g3X6A@MZ3l#<#8E{Ap-M37N5~ChDd6R`SNQJ zQ2B`~DN}(F(gBs&OMl_VF3RFJe9qUHzdub8ed`MaF=mf&KY~tOZ?cP)sOT+rYk_($ zGwcditD4-XA2uMDCh@QEh@^yO6snJ}trklWRwPprBP`c?C{fjt>uY=yq*vf=NiW$> x(}(bz=K-6j6rz-D!6fmmrUX(umTrN-!lchHz++#Y4pxsttoi~t1ykSJ{uh>*xO@Nr literal 0 HcmV?d00001 diff --git a/bin/cards/maumau/model/GameState.class b/bin/cards/maumau/model/GameState.class new file mode 100644 index 0000000000000000000000000000000000000000..808c0e9560757d9e004a0778cf6444c6e99ccd91 GIT binary patch literal 1217 zcmah|ZBNrs6n-w-+N~6rlXoVFplkyfAmGagVVM;d%VsPrseT}rQD@0sOxKa{tJLuU zqLKL7A7woEGGSkYuGu+Hd!BQj^U~jczFz>y;)RMHhIpBKhs|`2x9CpS8i!6bz0GTm z<#XRr5oG8;;>SE)<@HM1sJChi(e3Pxv7ayGck@{@|K51XFlpYDCc_YsoMOp%$IvJJ zT(*!iOhFF5HM2HDZ|-%mXc_y~UVfL5QP|s=EoIF;!(y2FaN7aljdInkyZ$CaAdxIl z)*RImMo0rgOvhaeGAJ9Jkl}=RU6ti~ZoQJpCrc5E9o7+o5{4?km=0BdumEu#VF4ln zOzDUSpb79mhXzG>vpRaAGYpt+-6^zc2adPP52_AnFdJoFEpg8kSU%JcK#Y|7pWG&i zJLc7vL(X&}c}uw(7O<$|G0mc@jFYDC)O4h=ME&NT$4|W{)VbgC=;cyZK0)5NS=?r3Yndh#pygM##>9{TvNT_5X|&SPRHdbX z0?~0XPGSUU^nK_j{s5sbgvC|)0cOXdfiv7W#gGIeK?z1B7!OG>A;CRGf=LPPs}f9y ze^Q1(8$*^IY-7~2Lv2i0w$jF=WvgvWTc?=$Mo0DFA^k6s9FSyeS`?CN5 literal 0 HcmV?d00001 diff --git a/bin/cards/maumau/model/IObserver.class b/bin/cards/maumau/model/IObserver.class new file mode 100644 index 0000000000000000000000000000000000000000..7854e8652df7371d42ae88d38e43fc561b1bb4e7 GIT binary patch literal 183 zcmYL@Jqp4=6oltR&1wX(vGV}2aSvc+BM3r@fc++UgoOOaZj!@UcmNM2zHJnync-t* z-k;|Sz!__WfUwVvEu3!6DAH|TaHFqD=Gabb73PF(Z6>1|)0H~OYR(5jI6ew9Fku!S z?gZ7cbEXu(i*J8A9cm*MIbINRT4A1Ozg-KnOppu#|+b@;Ra} DxmYW_ literal 0 HcmV?d00001 diff --git a/bin/cards/maumau/model/MauMau.class b/bin/cards/maumau/model/MauMau.class new file mode 100644 index 0000000000000000000000000000000000000000..b0e84a4d2d84c2faf7c4c315ca9bad54fd1b6093 GIT binary patch literal 6515 zcmb7I349!775{&mG`rmlNxDs2OF~&{OVc!M5TV7SA|<6Xnv_aPp`hqwcam4wrqu^0|6#B_+@&jG@dpmEPHmPt$rCQHHzVqN<7FnGqAz<#rNLGhH+)C}~23>ibA>6m@7d(2NBNbsa0Whp|W@{&X}(u@H+z>v)AF9YJ_? z;^=2C6xt2UK|>fzf=ySD9mNS)EJ`OC2qO~4vlZr-`P*RI=7f+K#Zt72+{p$SVT92^ zC;_;AX^CP5ItBGAh3?r}}?7nkkG8~vEa=dFeQnsg@?wQZvD}%2pm@ukNMAOW zPmN3z!8zi&&%j2ULp!OwWt;gNn|Wc!N?(lq-h6K(&P9J1n@M^ZXYs9p7ve=EFKg}P z^3Yne;71$AAPX{}P)ZORF@W<7Y?YR1D2yk~yd_T0H!y^43gMlmv&FT~eqrb;$2Dar zZzjeD&2caFjgFN~4qA?5j#$?uHe?K7~-6Caz~X zqHz+V@KytF!wn=pGgc&ivqw#NtE(;K+L_ugT-FX4c!z+KV%TV#d$y+1Rs`>2;UxJK zALnCFoIeq~o3Xl(ZZz;-QIXQ#m~x~EwATAXOHX);62Z*|K2Qw*d^0=7#*Fbma*Kfv zVNziZGoGGMII)6|kwVrzQFL$e2E7q{gywB+z=b5BK1#;ATvQ(uqCT#$X9jj$wrb7R z67@`G0?3Tuc6MLFZN0d|UX#LBNJVfL3u0Y7A&sWzGE#C=QgVm6N_OK+ks5H(yfWGx%H>pDivfF7OHw1E0tJ?3;`^u5gAw z=-Q-vh-!_nCBBFU!uS%=l)KaO)0a!9c_Pl)j)5=ZLH7Kv98ZW@E~O)$KbM-mou)lx zT~@HN3CmB=Gnx;8R`Tnz@Kpm3;cIlB&~SLP^#@yxwPN}5N`iZLnr9Av2{j5Q%vKD& z%+R=PjimOnjCor~W#sfAX)BDllM8&>vX1HcQaIf=Uz36vOH3j0|CjOX6&X-}F?QxH zaz6Fb?Sh|qPiND}vH4okz*CxD$lW7u^=?PXXFM46hVkRzOPDqo#iRI%oSuJL&TB<< z0hUX*0NJR2Zr~C8Vx|j&cA_sPS?-aNTlW$+!wK4xm$+}%r;@&cZChDyA7kl|!2n1; zz26!5HGZS_;c`p)x$e`qCAl~pkdGTBjw`ue4&@4V!rH_wi2IX{a*dcElCyKUJWJgi zAGGp2b4e$PzvG`_{DbGKaynAk-MKNVd%(;LCrt{PBc`-3&l>;2ziBd4o>F+w-@=}z zHm+}^&a#1AZmclw@8}_Y%=9gJ6^h$GTlWv$wecf8(Xi zA5y?+#+z!ve_3`sI4LFjOqkpH7S=}d96UAC6|PuEzQ{c;T2!6bQ(-kXtRlR6m2WH4XU9<!zQSrAyJ2=wwt-GAPU6B) z$J0qYVse}2C?*$V_nX&J_nQ}CN*%{>2u*0^xEU=R>zR4f01i@D?5yoPjQO3%uy6+l z&pL!Qj!%&BiH8v9cbNEDmI2F$&A{m`VoFPiW#j9u5azN4w1!g=RgzQ;7*?9x{@NJK*`lG z5}c8w`IWn>mHPvglduAm+p3k%4^Zam2BV(xsr(jH5yEbp!p>^_OMLnf54n>2WUzkv zwyMaJf%?38dirZC{pYGnb&Oo618wjKt!=0}R*;nZ9(!l(pzrxTv70KM-+vSzO?8^D?Cn|O77UR<9(tU z?>&Kdd06xCR>k|3@Wx>OP;KX-Ks)>w!|ZncSZ(LwKs)@OP(VCf yy#7?J|5$*29sbOWh42^rmETgK|6zWfR3TL_BQ-}gDnm&Z@v^U)REvsX@&5qdV_ir9 literal 0 HcmV?d00001 diff --git a/bin/cards/maumau/model/Player.class b/bin/cards/maumau/model/Player.class new file mode 100644 index 0000000000000000000000000000000000000000..e93999583fc70f8aa4b5e315e4afeb3f2b0a2b6d GIT binary patch literal 4784 zcmcIn`+F2u8GdIs$%JJfVFPIrO1scdvKwGqQA-U)LxeUof$CyHQg4&pNit-2W;-(* zNJXnH)LUEYtp!xtdI8&_7KK2-Uc6Roz2AQI@9^oPzGvp_W;WSCfAM)TJ7>=MzVCg% z+c_t1{O8Im0DAFH6%hsPS>4IG>4IM3U%FuDjC}gOygp+%D(Vz8AJV7wbY8b6()-5_ z8Cg$3-Gp8+6s#Snp*g6R_}4=r%NL3d%aLO z& ztITS+4YxC%1-+}T;6v;H34f1n^60xi6sDOi#5 z^z782Ui9|~6|C4;z)j$gLXo?2Fl_1yt0sp8hbawt!J)x13ih<2f@mB3_VBBqpKURr z=X;%rQo*pi-AA%UQFL|;yHM2d02nuQTF;k^{o@L5t>r?fOJupk5y9>l3Mh$9bb5j7 z!_K&%SGi^9*CTTQNGI{D& zf+RkBM1vg1*EM_vUu88>xLi&CGS4@6$}9?*QyNbA=bL5UA-=z*;T!%peG>4`YIqLc z4q_FA@OrVTl47jBi!&;|S36c!vKmg~EIY28?y9KD^og^%Ay^QWU(oPz9I`nWDmtr-n3;}x1L%ugwJGwgxX42%c4aytiXd#Y5d zvB`&=s!}{KQ>;4o-u_|$8HQS{8$Md(YM-9ZXH3uNX==dS^>-MVlxDmpE@{8ekihz; zdi} zjH3v(nvq40_6%BWLi8=vD{rAm#rVIO0#QV!DHE?@ z^7$o9o~FrXsQ7FRlM!(zm9cQxt%BvYRAA`n8Bwib9DlL?Wkg4!a()&+$c)tSqb+k8 zKbpl)LKPi!(es3Sft~asZpXP0?6&G$tf0%YM2xU2FZ12T?^pT!48O#$@g~{)-v9k0 Q{>)WzlKcgK!#~jeKLpEs(EtDd literal 0 HcmV?d00001 diff --git a/bin/cards/maumau/model/PlayerHandler.class b/bin/cards/maumau/model/PlayerHandler.class new file mode 100644 index 0000000000000000000000000000000000000000..7ce73d1447d4334a999543cd612e35e8bf82de68 GIT binary patch literal 1757 zcmah~YflqV5Iwg%7Rmy(yyX4x)fQnD#Ro+MD@0;JBLt(LytHdsXqRTYHS$yZ1%A~; zLe#|g*&k&*cXtaFTbpd#nLD#*X3m+L{`&px2Y?l1b#ci0sRE(#T6YXFS{8H#4q4b50gaf#GxwfDKvZlN8X39#n}4X%C|8 zT6rUFm0Skfx2&8k-LgZNnRDUATCjd!$t4BsNc+IDa{_ISSuhK`rcd?@pVMw6o zEOEtgBEf7??}f|esI|A?pfq= zs#gDhiAILnZ1cUlU3P5F6I)kf37TS^(@^PpECg(M=|ytJR4+T6GhIK%`q5bYoLsDD z{BzhyLxuUGB4fMEX8i)JTJ*L?pfj&X*gPFXe@h8VdzHKh0a9hhG3}r?fl+o*VEbe-v=q|vbewN+MWwNP}AJjGwD><2oQ@Q`e>)SBg#xcI%5L94DqQp1YC zVBN|bWy_VBgAG{>qzrEzmYs~bW_e=!{RKB}R`rGnu16CuYBQp0M`%UWcJZ{Gb_ikm z+@dN!1Rb4>h56}1HzN^RS)zpaJCQiSg~WICzB)nwF$QQ3(i}d&tGLuqtLwNiL+!H+Y literal 0 HcmV?d00001 diff --git a/src/cards/Card.java b/src/cards/Card.java new file mode 100644 index 0000000..561feb4 --- /dev/null +++ b/src/cards/Card.java @@ -0,0 +1,29 @@ +package cards; + +/** + * Represents a playing card with a rank and a suit. + */ +public record Card(Rank rank, Suit suit) implements Comparable { + + /** + * Returns a string representation of the card. + * + * @return A string representing the card's rank followed by its suit. + */ + @Override + public String toString() { + return rank.toString() + suit; + } + + /** + * Compares this card with another card for order. + * + * @param other The card to be compared. + * @return A negative integer, zero, or a positive integer if this card is less than, equal to, or greater than the specified card. + */ + @Override + public int compareTo(Card other) { + //TODO implement + return 0; + } +} diff --git a/src/cards/Rank.java b/src/cards/Rank.java new file mode 100644 index 0000000..ba0fe06 --- /dev/null +++ b/src/cards/Rank.java @@ -0,0 +1,19 @@ +package cards; + +/** + * Represents the ranks of playing cards. + */ +public enum Rank { + TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, JACK, QUEEN, KING, ACE; + + /** + * Returns a string representation of the rank. + * + * @return A string representing the rank. + */ + @Override + public String toString() { + //TODO implement + return super.toString(); + } +} diff --git a/src/cards/Suit.java b/src/cards/Suit.java new file mode 100644 index 0000000..333688d --- /dev/null +++ b/src/cards/Suit.java @@ -0,0 +1,34 @@ +package cards; + +/** + * Represents the suits of playing cards. + */ +public enum Suit { + /** + * Represents the Hearts suit. + */ + HEARTS, + /** + * Represents the Diamonds suit. + */ + DIAMONDS, + /** + * Represents the Clubs suit. + */ + CLUBS, + /** + * Represents the Spades suit. + */ + SPADES; + + /** + * Returns a string representation of the suit. + * + * @return A string representing the suit. + */ + @Override + public String toString() { + //TODO implement + return super.toString(); + } +} diff --git a/src/cards/maumau/MauMauDeck.java b/src/cards/maumau/MauMauDeck.java new file mode 100644 index 0000000..9595b17 --- /dev/null +++ b/src/cards/maumau/MauMauDeck.java @@ -0,0 +1,26 @@ +package cards.maumau; + +import cards.Card; + +import java.util.List; + +/** + * Represents a deck of cards used in the Mau-Mau game. + */ +public class MauMauDeck { + /** + * Private constructor to prevent instantiation of this class. + */ + private MauMauDeck() { /* do nothing */ } + + /** + * Generates a deck of Mau-Mau cards and shuffles it. + * + * @param numDecks Number of decks to be included in the game. + * @return A list containing the generated deck of cards. + */ + public static List makeDeck(int numDecks) { + //TODO implement + return null; + } +} diff --git a/src/cards/maumau/MauMauGame.java b/src/cards/maumau/MauMauGame.java new file mode 100644 index 0000000..23425bc --- /dev/null +++ b/src/cards/maumau/MauMauGame.java @@ -0,0 +1,82 @@ +package cards.maumau; + +import cards.Card; +import cards.maumau.gui.PlayerFrame; +import cards.maumau.model.MauMau; +import cards.maumau.model.Player; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; + +/** + * Represents the main class for running the Mau-Mau card game. + */ +public class MauMauGame { + + /** + * Prints usage information for running the game. + */ + private static void usage() { + System.err.println("usage: <#cards per player> <#decks> ..."); + System.err.println(" where <#cards per player> >= 2 and <#decks> >= 1"); + System.exit(1); + } + + /** + * Main method for running the Mau-Mau game. + * + * @param args Command line arguments. + */ + public static void main(String[] args) { + if (args.length == 0) + makeSimpleGame(); + else + makeGeneralGame(args); + } + + /** + * Runs a simple game with predefined settings. + */ + private static void makeSimpleGame() { + final List deck = MauMauDeck.makeDeck(1); + final MauMau game = new MauMau(5, deck); + game.addPlayer("Jacqueline"); + game.addPlayer("Chantal"); + start(game); + } + + /** + * Runs a game with customizable settings based on command line arguments. + * + * @param args Command line arguments specifying game parameters. + */ + private static void makeGeneralGame(String[] args) { + if (args.length < 4) usage(); + final Iterator it = Arrays.asList(args).iterator(); + try { + final int numCardsPerPlayer = Integer.parseInt(it.next()); + final int numDecks = Integer.parseInt(it.next()); + if (numCardsPerPlayer < 2 || numDecks < 1) usage(); + final List deck = MauMauDeck.makeDeck(numDecks); + final MauMau game = new MauMau(numCardsPerPlayer, deck); + while (it.hasNext()) + game.addPlayer(it.next()); + start(game); + } + catch (NumberFormatException ex) { + usage(); + } + } + + /** + * Starts the Mau-Mau game. + * + * @param game The Mau-Mau game to start. + */ + private static void start(MauMau game) { + game.startGame(); + for (Player player : game.getPlayers()) + new PlayerFrame(player).setVisible(true); + } +} diff --git a/src/cards/maumau/gui/CardListRenderer.java b/src/cards/maumau/gui/CardListRenderer.java new file mode 100644 index 0000000..a9c1bdc --- /dev/null +++ b/src/cards/maumau/gui/CardListRenderer.java @@ -0,0 +1,49 @@ +package cards.maumau.gui; + +import cards.Card; +import cards.maumau.model.Player; + +import javax.swing.DefaultListCellRenderer; +import javax.swing.JList; +import java.awt.Component; + +import static java.awt.Color.GREEN; +import static java.awt.Color.RED; + +/** + * Custom renderer for rendering cards in a JList representing the cards on a player's hand. + */ +class CardListRenderer extends DefaultListCellRenderer { + private final transient Player player; + + /** + * Constructs a CardListRenderer object. + * + * @param player The player associated with the renderer. + */ + CardListRenderer(Player player) { + this.player = player; + } + + /** + * Custom rendering of list cell components. + * + * @param list The JList being rendered. + * @param value The value to be rendered. + * @param index The cell index. + * @param isSelected True if the cell is selected. + * @param cellHasFocus True if the cell has focus. + * @return The rendered component. + */ + @Override + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + final Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + if (value instanceof Card card) { + setText(card.toString()); + setBackground(player.canPlay(card) ? GREEN : RED); + if (isSelected) + setBackground(getBackground().darker()); + } + return c; + } +} diff --git a/src/cards/maumau/gui/GameTableModel.java b/src/cards/maumau/gui/GameTableModel.java new file mode 100644 index 0000000..223f5dd --- /dev/null +++ b/src/cards/maumau/gui/GameTableModel.java @@ -0,0 +1,67 @@ +package cards.maumau.gui; + +import cards.maumau.model.MauMau; + +import javax.swing.table.AbstractTableModel; + +import static cards.maumau.model.GameState.GAME_CANCELED; +import static cards.maumau.model.GameState.GAME_OVER; + +/** + * Represents the table model for displaying player information in the Mau-Mau game. + */ +class GameTableModel extends AbstractTableModel { + private final transient MauMau game; + + /** + * Constructs a GameTableModel object. + * + * @param game The Mau-Mau game. + */ + public GameTableModel(MauMau game) { + this.game = game; + } + + /** + * Updates the table data. + */ + void update() { + fireTableDataChanged(); + } + + @Override + public int getRowCount() { + if (showRanking()) + return game.getRanking().size(); + return game.getPlayers().size(); + } + + @Override + public int getColumnCount() { + return 2; + } + + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + if (showRanking()) + return switch (columnIndex) { + case 0 -> game.getRanking().get(rowIndex).getName(); + case 1 -> rowIndex + 1; + default -> null; + }; + return switch (columnIndex) { + case 0 -> game.getPlayers().get(rowIndex).getName(); + case 1 -> game.getPlayers().get(rowIndex).getCards().size(); + default -> null; + }; + } + + /** + * Checks if the ranking should be shown based on the current game state. + * + * @return True if the ranking should be shown, false otherwise. + */ + private boolean showRanking() { + return game.getGameState() == GAME_CANCELED || game.getGameState() == GAME_OVER; + } +} diff --git a/src/cards/maumau/gui/PlayerFrame.java b/src/cards/maumau/gui/PlayerFrame.java new file mode 100644 index 0000000..850f28f --- /dev/null +++ b/src/cards/maumau/gui/PlayerFrame.java @@ -0,0 +1,231 @@ +package cards.maumau.gui; + +import cards.Card; +import cards.Suit; +import cards.maumau.model.IObserver; +import cards.maumau.model.MauMau; +import cards.maumau.model.Player; + +import javax.swing.BorderFactory; +import javax.swing.DefaultListModel; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JTable; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.List; + +import static cards.maumau.model.GameState.CHOOSE_SUIT; +import static cards.maumau.model.GameState.GAME_CANCELED; +import static cards.maumau.model.GameState.GAME_OVER; +import static java.awt.BorderLayout.CENTER; +import static java.awt.Color.GREEN; +import static java.awt.Color.RED; + +/** + * Represents the graphical user interface for a player in the Mau-Mau card game. + */ +public class PlayerFrame extends JFrame implements IObserver { + private final transient Player player; + private final GameTableModel playerTableModel; + private final DefaultListModel cardListModel = new DefaultListModel<>(); + private final JList cardList = new JList<>(cardListModel); + private final JLabel topCardLabel = new JLabel("top card:"); + private final JLabel stateLabel = new JLabel("game starts"); + private final JPanel pane = new JPanel(new GridBagLayout()); + + /** + * Constructs a new PlayerFrame object. + * + * @param player The player associated with this frame. + */ + public PlayerFrame(Player player) { + super(player.getName()); + this.player = player; + final MauMau game = player.getGame(); + playerTableModel = new GameTableModel(game); + update(); + initializeUI(); + game.addObserver(this); + } + + /** + * Initializes the user interface components. + */ + private void initializeUI() { + getContentPane().setLayout(new BorderLayout()); + getContentPane().add(pane, CENTER); + + final GridBagConstraints constraints = new GridBagConstraints(); + constraints.gridx = 0; + constraints.gridy = 0; + constraints.gridheight = 9; + constraints.weightx = 1; + constraints.weighty = 1; + constraints.fill = GridBagConstraints.BOTH; + constraints.ipadx = 15; + constraints.ipady = 15; + constraints.insets = new Insets(5, 5, 5, 5); + + cardList.setBorder(BorderFactory.createLoweredBevelBorder()); + cardList.setCellRenderer(new CardListRenderer(player)); + pane.add(cardList, constraints); + + constraints.gridx = 1; + constraints.gridheight = 1; + constraints.gridwidth = 4; + constraints.weightx = 0; + constraints.weighty = 0; + constraints.fill = GridBagConstraints.HORIZONTAL; + final JTable table = new JTable(playerTableModel); + table.setBorder(BorderFactory.createLoweredBevelBorder()); + pane.add(table, constraints); + + constraints.gridy++; + constraints.ipadx = 0; + constraints.ipady = 5; + constraints.insets = new Insets(0, 0, 0, 0); + pane.add(topCardLabel, constraints); + + constraints.gridy++; + pane.add(stateLabel, constraints); + + constraints.gridy++; + pane.add(makeButton("choose card", this::chooseCard), constraints); + + constraints.gridy++; + pane.add(makeButton("skip", e -> player.skip()), constraints); + + constraints.gridy++; + constraints.gridwidth = 1; + for (Suit suit : Suit.values()) { + pane.add(makeButton(suit.toString(), e -> player.chooseSuit(suit)), constraints); + constraints.gridx++; + } + + constraints.gridy++; + constraints.gridx = 1; + constraints.gridwidth = 4; + pane.add(makeButton("have no 7", e -> player.no7()), constraints); + + constraints.gridy++; + constraints.gridwidth = 2; + pane.add(makeButton("\"Mau\"", e -> player.mau()), constraints); + + constraints.gridx = 3; + pane.add(makeButton("\"Mau-Mau\"", e -> player.maumau()), constraints); + + pack(); + } + + /** + * Creates a JButton with the specified text and action listener. + * + * @param text The text displayed on the button. + * @param listener The action listener for the button. + * @return The created JButton. + */ + private JButton makeButton(String text, ActionListener listener) { + final JButton button = new JButton(text); + button.addActionListener(listener); + return button; + } + + /** + * Action performed when the "choose card" button is clicked. + * + * @param e The ActionEvent object. + */ + private void chooseCard(ActionEvent e) { + final List selected = cardList.getSelectedValuesList(); + if (selected.size() == 1) + player.chooseCard(selected.getFirst()); + else if (selected.isEmpty()) + error("You must select a card first!"); + else + error("You must not select more than a single card!"); + } + + /** + * Updates the user interface. + */ + @Override + public void update() { + playerTableModel.update(); + updateCardList(); + updateTopCardLabel(); + updateStateLabel(); + updateBorderColor(); + } + + /** + * Updates the card list displayed in the UI. + */ + private void updateCardList() { + cardListModel.clear(); + player.getCards().stream().sorted().forEach(cardListModel::addElement); + } + + /** + * Updates the label displaying the top card on the discard pile. + */ + private void updateTopCardLabel() { + final List pile = player.getGame().getDiscardPile(); + topCardLabel.setText(pile.isEmpty() ? "no top card" : "top card: " + pile.getFirst()); + } + + /** + * Updates the label displaying the current game state. + */ + private void updateStateLabel() { + final MauMau game = player.getGame(); + if (game.getGameState() == GAME_CANCELED) + stateLabel.setText("Game canceled"); + else if (game.getGameState() == GAME_OVER) + stateLabel.setText("Game over"); + else if (game.get7Counter() > 0) + stateLabel.setText(game.get7Counter() + " seven on discard pile"); + else if (game.getChosenSuit() != null) + stateLabel.setText(game.getChosenSuit() + " chosen"); + else if (game.getGameState() == CHOOSE_SUIT && game.getCurrentPlayer() == player) + stateLabel.setText("Choose a suit"); + else + stateLabel.setText(" "); + } + + /** + * Updates the border color of the frame based on the current player's turn. + */ + private void updateBorderColor() { + final Color borderColor = player.getGame().getCurrentPlayer() == player ? GREEN : RED; + pane.setBorder(BorderFactory.createLineBorder(borderColor, 5)); + } + + /** + * Displays an error message dialog. + * + * @param msg The error message to display. + */ + private void error(String msg) { + JOptionPane.showMessageDialog(this, msg, "Error", JOptionPane.ERROR_MESSAGE); + } + + /** + * Displays a message dialog. + * + * @param msg The message to display. + */ + @Override + public void message(String msg) { + JOptionPane.showMessageDialog(this, msg, "Message", JOptionPane.INFORMATION_MESSAGE); + } +} diff --git a/src/cards/maumau/model/ActionHandler.java b/src/cards/maumau/model/ActionHandler.java new file mode 100644 index 0000000..e4cbbdb --- /dev/null +++ b/src/cards/maumau/model/ActionHandler.java @@ -0,0 +1,153 @@ +package cards.maumau.model; + +import cards.Card; +import cards.Suit; + +/** + * Manages the actions and state transitions within a MauMau game. + */ +class ActionHandler { + private final MauMau game; + private Suit chosenSuit; + private int ctr7 = 0; + + /** + * Constructs an ActionHandler for the specified MauMau game. + * + * @param game The MauMau game instance. + */ + ActionHandler(MauMau game) { + this.game = game; + } + + /** + * Adds the specified player to the game. + * + * @param player The player to be added to the game. + */ + void addPlayer(Player player) { + //TODO implement + } + + /** + * Starts the game. + */ + void startGame() { + //TODO implement + } + + /** + * Transitions the game state to GAME_OVER. + */ + void finishGame() { + //TODO implement + } + + /** + * Transitions the game state to GAME_CANCELED. + */ + void cancelGame() { + //TODO implement + } + + /** + * Handles the player's choice of a card in the current state. + * + * @param c The card chosen by the player. + */ + void chooseCard(Card c) { + //TODO implement + } + + /** + * Handles the player's choice of a suit in the current state. + * + * @param suit The suit chosen by the player. + */ + void chooseSuit(Suit suit) { + //TODO implement + } + + /** + * Lets the player skip a round. + **/ + void skip() { + //TODO implement + } + + /** + * Handles the player saying "no 7" in the current state. + */ + void no7() { + //TODO implement + } + + /** + * Returns the MauMau game instance associated with this action handler. + * + * @return The MauMau game instance. + */ + MauMau getGame() { + return game; + } + + /** + * Returns the suit chosen by a player after playing a Jack card. + * + * @return The chosen suit. + */ + Suit getChosenSuit() { + return chosenSuit; + } + + /** + * Sets the suit chosen by a player after playing a Jack card. + * + * @param chosenSuit The suit chosen by the player. + */ + void setChosenSuit(Suit chosenSuit) { + this.chosenSuit = chosenSuit; + } + + /** + * Returns the number of number 7 cards played recently. + * + * @return The number of number 7 cards played recently. + */ + int get7Counter() { + return ctr7; + } + + /** + * Resets the counter of number 7 cards played to zero. + */ + void reset7Counter() { + ctr7 = 0; + } + + /** + * Increments the counter of number 7 cards played by one. + */ + void increment7Counter() { + ctr7++; + } + + /** + * Returns the current state of the game. + */ + GameState getGameState() { + //TODO implement + return null; + } + + /** + * Checks if a card can be played by the current player in the current state. + * + * @param c The card being played. + * @return True if the card can be played, false otherwise. + */ + boolean canPlay(Card c) { + //TODO implement + return false; + } +} diff --git a/src/cards/maumau/model/CardHandler.java b/src/cards/maumau/model/CardHandler.java new file mode 100644 index 0000000..c69a174 --- /dev/null +++ b/src/cards/maumau/model/CardHandler.java @@ -0,0 +1,96 @@ +package cards.maumau.model; + +import cards.Card; + +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; + +/** + * Manages the draw pile and discard pile in a MauMau game. + */ +class CardHandler { + private final MauMau game; + private final int numCardsPerPlayer; + private final List drawPile = new LinkedList<>(); + private final List discardPile = new LinkedList<>(); + + /** + * Constructs a CardHandler for the specified MauMau game, deck, and number of cards per player. + * + * @param game The MauMau game instance. + * @param deck The deck of cards. + * @param numCardsPerPlayer The number of cards per player. + */ + CardHandler(MauMau game, List deck, int numCardsPerPlayer) { + this.game = game; + this.numCardsPerPlayer = numCardsPerPlayer; + drawPile.addAll(deck); + } + + /** + * Returns the draw pile containing remaining cards. + * + * @return The draw pile. + */ + List getDrawPile() { + return drawPile; + } + + /** + * Returns the discard pile containing played cards. + * + * @return The discard pile. + */ + List getDiscardPile() { + return discardPile; + } + + /** + * Draws a card from the draw pile. + * + * @return The drawn card, or null if the draw pile is empty. + */ + Card drawCard() { + if (drawPile.isEmpty()) + reuseDiscardedCards(); + if (!drawPile.isEmpty()) + return drawPile.removeFirst(); + game.getActionHandler().cancelGame(); + return null; + } + + private void reuseDiscardedCards() { + if (discardPile.isEmpty()) return; + final Card top = discardPile.removeFirst(); + Collections.shuffle(discardPile); + drawPile.addAll(discardPile); + discardPile.clear(); + discardPile.addFirst(top); + } + + /** + * Deals cards to all players. + */ + void dealCards() { + //TODO implement + } + + /** + * Discards a card onto the discard pile. + * + * @param c The card to discard. + */ + void discard(Card c) { + discardPile.addFirst(c); + } + + /** + * Returns the top card of the discard pile. + * + * @return The top card of the discard pile. + */ + Card top() { + return discardPile.getFirst(); + } +} diff --git a/src/cards/maumau/model/GameState.java b/src/cards/maumau/model/GameState.java new file mode 100644 index 0000000..b85a2c7 --- /dev/null +++ b/src/cards/maumau/model/GameState.java @@ -0,0 +1,29 @@ +package cards.maumau.model; + +/** + * Represents the state of the Mau-Mau game. + */ +public enum GameState { + /** + * The game has been initialized, but has not yet started. + */ + GAME_INITIALIZED, + /** + * The game is over. The final ranking of players can be + * obtained using {@link MauMau#getRanking()}. + */ + GAME_OVER, + /** + * The game has been canceled due to insufficient cards. + */ + GAME_CANCELED, + /** + * The game is currently in progress with players taking turns. + */ + PLAY, + /** + * The game is in progress and the current player has played + * a Jack, and is required to choose a suit. + */ + CHOOSE_SUIT +} diff --git a/src/cards/maumau/model/IObserver.java b/src/cards/maumau/model/IObserver.java new file mode 100644 index 0000000..f5ca908 --- /dev/null +++ b/src/cards/maumau/model/IObserver.java @@ -0,0 +1,18 @@ +package cards.maumau.model; + +/** + * Interface for observing changes in the Mau-Mau game. + */ +public interface IObserver { + /** + * Method called to notify the observer of a general update in the game. + */ + void update(); + + /** + * Method called to send a message to the observer. + * + * @param msg The message to be sent. + */ + void message(String msg); +} diff --git a/src/cards/maumau/model/MauMau.java b/src/cards/maumau/model/MauMau.java new file mode 100644 index 0000000..46ae664 --- /dev/null +++ b/src/cards/maumau/model/MauMau.java @@ -0,0 +1,227 @@ +package cards.maumau.model; + +import cards.Card; +import cards.Suit; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * Represents a Mau-Mau card game. + */ +public class MauMau { + private final ActionHandler actionHandler = new ActionHandler(this); + private final PlayerHandler playerHandler = new PlayerHandler(this); + private final CardHandler cardHandler; + private final List observers = new ArrayList<>(); + + /** + * Constructs a MauMau game with the specified parameters. + * + * @param numCardsPerPlayer The number of cards each player should have initially. + * @param deck The deck of cards to be used in the game. + */ + public MauMau(int numCardsPerPlayer, List deck) { + cardHandler = new CardHandler(this, deck, numCardsPerPlayer); + } + + /** + * Adds an observer to the game. + * + * @param observer The observer to add. + */ + public void addObserver(IObserver observer) { + observers.add(observer); + } + + /** + * Notifies all observers of the game. + */ + void notifyObservers() { + for (IObserver o : observers) + o.update(); + } + + /** + * Sends a message to all observers. + * + * @param msg The message to send. + */ + void sendMessage(String msg) { + for (IObserver o : observers) + o.message(msg); + } + + /** + * Gets the player handler for the game. + * + * @return The player handler. + */ + PlayerHandler getPlayerHandler() { + return playerHandler; + } + + /** + * Gets the card handler for the game. + * + * @return The card handler. + */ + CardHandler getCardHandler() { + return cardHandler; + } + + /** + * Gets the action handler for the game. + * + * @return The action handler. + */ + ActionHandler getActionHandler() { + return actionHandler; + } + + /** + * Returns the suit chosen by a player after playing a Jack. + * + * @return The chosen suit. + */ + public Suit getChosenSuit() { + return actionHandler.getChosenSuit(); + } + + /** + * Returns the number of number 7 cards played recently. + * + * @return The number of number 7 cards played recently. + */ + public int get7Counter() { + return actionHandler.get7Counter(); + } + + /** + * Starts the Mau-Mau game. + */ + public void startGame() { + actionHandler.startGame(); + } + + /** + * Returns a string representation of the game. + * + * @return String representation of the game. + */ + @Override + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("Game state: ").append(getGameState()).append("\n"); + sb.append("State: ").append(actionHandler).append("\n"); + sb.append("Players:\n"); + sb.append(mkString(getPlayers(), " ", "\n ")); + sb.append(mkString(getDrawPile(), "draw pile: ", " ")); + sb.append(mkString(getDiscardPile(), "discard pile: ", " ")); + sb.append(mkString(getRanking(), Player::getName, "ranking: ", ", ", "\n")); + sb.append("chosen suit: ").append(getChosenSuit()).append("\n"); + sb.append("7 count: ").append(get7Counter()).append("\n"); + return sb.toString(); + } + + /** + * Joins the elements of the list into a single string with the specified prefix and delimiter. + * + * @param list The list to join. + * @param func Function to convert list elements to strings. + * @param prefix Prefix for the resulting string. + * @param delimiter Delimiter to separate list elements. + * @param suffix Suffix for the resulting string. + * @param Type of elements in the list. + * @return Joined string representation of the list. + */ + static String mkString(List list, Function func, String prefix, String delimiter, String suffix) { + return list.stream() + .map(func) + .collect(Collectors.joining(delimiter, prefix, suffix)); + } + + /** + * Joins the elements of the list into a single string with the specified prefix and delimiter. + * + * @param list The list to join. + * @param prefix Prefix for the resulting string. + * @param delimiter Delimiter to separate list elements. + * @param Type of elements in the list. + * @return Joined string representation of the list. + */ + static String mkString(List list, String prefix, String delimiter) { + return mkString(list, Objects::toString, prefix, delimiter, "\n"); + } + + /** + * Gets the list of players still participating in the game. + * The first player in the list is the current player. + * + * @return The list of players. + */ + public List getPlayers() { + return playerHandler.getPlayers(); + } + + /** + * Adds a player to the game. + * + * @param name The name of the player. + * @return The player added to the game. + */ + public Player addPlayer(String name) { + final Player player = new Player(name, this); + actionHandler.addPlayer(player); + return player; + } + + /** + * Returns the ranking of players that have already discarded all of their cards + * and, when the game is over, also the loser. + * + * @return The ranking of players. + */ + public List getRanking() { + return playerHandler.getRanking(); + } + + /** + * Returns the current player whose turn it is. + * + * @return The current player. + */ + public Player getCurrentPlayer() { + return playerHandler.getCurrentPlayer(); + } + + /** + * Returns the draw pile containing remaining cards. + * + * @return The draw pile. + */ + public List getDrawPile() { + return cardHandler.getDrawPile(); + } + + /** + * Returns the discard pile containing played cards. + * + * @return The discard pile. + */ + public List getDiscardPile() { + return cardHandler.getDiscardPile(); + } + + /** + * Returns the current state of the game. + * + * @return The state of the game. + */ + public GameState getGameState() { + return actionHandler.getGameState(); + } +} diff --git a/src/cards/maumau/model/Player.java b/src/cards/maumau/model/Player.java new file mode 100644 index 0000000..a1ef343 --- /dev/null +++ b/src/cards/maumau/model/Player.java @@ -0,0 +1,174 @@ +package cards.maumau.model; + +import cards.Card; +import cards.Suit; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * Represents a player in a Mau-Mau card game. + */ +public class Player { + private final MauMau game; + private final String name; + private final List cards = new ArrayList<>(); + + /** + * Constructor for Player class. + * + * @param name The name of the player. + * @param game The MauMau game instance the player is part of. + */ + Player(String name, MauMau game) { + this.name = name; + this.game = game; + } + + /** + * Returns a string representation of the player, including their name and their cards. + * + * @return String representation of the player. + */ + @Override + public String toString() { + return name + cards.stream() + .map(Object::toString) + .collect(Collectors.joining(" ", " (cards ", ")")); + } + + /** + * Gets the name of the player. + * + * @return The name of the player. + */ + public String getName() { + return name; + } + + /** + * Gets the MauMau game instance the player is part of. + * + * @return The MauMau game instance. + */ + public MauMau getGame() { + return game; + } + + /** + * Gets the list of cards held by the player. + * + * @return List of cards held by the player. + */ + public List getCards() { + return cards; + } + + /** + * Draws a specified number of cards from the draw pile. + * + * @param n The number of cards to draw. + */ + void drawCards(int n) { + for (int i = 0; i < n; i++) { + final Card c = game.getCardHandler().drawCard(); + if (c == null) return; + cards.add(c); + } + } + + /** + * Plays a card from the player's hand onto the discard pile. + * + * @param c The card to be played. + */ + void playCard(Card c) { + if (!cards.remove(c)) + throw new IllegalArgumentException(this + " doesn't have " + c); + game.getCardHandler().discard(c); + } + + /** + * Checks if the player can legally play a specific card. + * + * @param c The card to check. + * @return True if the player can legally play the card, false otherwise. + */ + public boolean canPlay(Card c) { + return game.getCurrentPlayer() == this && game.getActionHandler().canPlay(c); + } + + /** + * Selects a card to play from the player's hand. + * + * @param c The card to play. + */ + public void chooseCard(Card c) { + if (isCurrentPlayer()) { + game.getActionHandler().chooseCard(c); + game.notifyObservers(); + } + } + + /** + * Chooses a suit after playing a Jack card. + * + * @param s The suit chosen by the player. + */ + public void chooseSuit(Suit s) { + if (isCurrentPlayer()) { + game.getActionHandler().chooseSuit(s); + game.notifyObservers(); + } + } + + /** + * Skips the player's turn. + */ + public void skip() { + if (isCurrentPlayer()) { + game.getActionHandler().skip(); + game.notifyObservers(); + } + } + + /** + * Executes special action when the player cannot play a seven card. + */ + public void no7() { + if (isCurrentPlayer()) { + game.getActionHandler().no7(); + game.notifyObservers(); + } + } + + /** + * Executes special action when the player calls "Mau". + */ + public void mau() { + game.getPlayerHandler().mau(this); + game.notifyObservers(); + } + + /** + * Executes special action when the player calls "Mau-Mau". + */ + public void maumau() { + game.getPlayerHandler().maumau(this); + game.notifyObservers(); + } + + /** + * Checks if the current player is this player instance. + * If not, sends a message indicating it's not their turn. + * + * @return True if it's this player's turn, false otherwise. + */ + private boolean isCurrentPlayer() { + if (this == game.getCurrentPlayer()) + return true; + game.sendMessage(String.format("It's %s's turn, not %s's.", game.getCurrentPlayer().getName(), name)); + return false; + } +} diff --git a/src/cards/maumau/model/PlayerHandler.java b/src/cards/maumau/model/PlayerHandler.java new file mode 100644 index 0000000..8a145c7 --- /dev/null +++ b/src/cards/maumau/model/PlayerHandler.java @@ -0,0 +1,106 @@ +package cards.maumau.model; + +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; + +/** + * Handles players in a MauMau game. + */ +class PlayerHandler { + private final MauMau game; + private final List players = new LinkedList<>(); + private final List ranking = new ArrayList<>(); + private Player remember; + + /** + * Constructs a PlayerHandler for the specified MauMau game. + * + * @param game The MauMau game instance. + */ + PlayerHandler(MauMau game) { + this.game = game; + } + + /** + * Initiates the next turn in the game. + * + * @param n The number of turns to proceed. + */ + void nextTurn(int n) { + //TODO implement + } + + /** + * Handles a player calling "Mau". + * + * @param p The player calling "Mau". + */ + void mau(Player p) { + //TODO implement + } + + /** + * Handles a player calling "Mau-Mau". + * + * @param p The player calling "Mau-Mau". + */ + void maumau(Player p) { + //TODO implement + } + + /** + * Returns the list of players participating in the game. + * + * @return The list of players. + */ + List getPlayers() { + return players; + } + + /** + * Returns the ranking of players based on the order they finished the game. + * + * @return The ranking of players. + */ + List getRanking() { + return ranking; + } + + /** + * Adds a player to the game. + * + * @param player The player to add. + * @throws IllegalArgumentException if a player with the same name already exists. + */ + void addPlayer(Player player) { + //TODO implement + } + + /** + * Moves to the next player's turn in the game. + * + * @param n The number of turns to proceed. + */ + private void localNextTurn(int n) { + //TODO implement + } + + /** + * Finishes a player's participation in the game. + * + * @param p The player to finish. + */ + private void finishPlayer(Player p) { + //TODO implement + } + + /** + * Returns the current player whose turn it is. + * + * @return The current player. + */ + Player getCurrentPlayer() { + return players.isEmpty() ? null : players.getFirst(); + } +} diff --git a/test/cards/CardTest.java b/test/cards/CardTest.java new file mode 100644 index 0000000..f8ffc00 --- /dev/null +++ b/test/cards/CardTest.java @@ -0,0 +1,25 @@ +package cards; + +import org.junit.Test; + +import static cards.Rank.THREE; +import static cards.Rank.TWO; +import static cards.Suit.HEARTS; +import static cards.Suit.SPADES; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class CardTest { + private static Card c(Rank r, Suit s) { + return new Card(r, s); + } + + @Test + public void compareToTest() { + assertEquals(0, c(TWO, HEARTS).compareTo(c(TWO, HEARTS))); + assertTrue(c(TWO, HEARTS).compareTo(c(TWO, SPADES)) < 0); + assertTrue(c(TWO, SPADES).compareTo(c(TWO, HEARTS)) > 0); + assertTrue(c(TWO, SPADES).compareTo(c(THREE, HEARTS)) < 0); + assertTrue(c(THREE, HEARTS).compareTo(c(TWO, SPADES)) > 0); + } +} diff --git a/test/cards/RankTest.java b/test/cards/RankTest.java new file mode 100644 index 0000000..b2c7e24 --- /dev/null +++ b/test/cards/RankTest.java @@ -0,0 +1,37 @@ +package cards; + +import org.junit.Test; + +import static cards.Rank.ACE; +import static cards.Rank.EIGHT; +import static cards.Rank.FIVE; +import static cards.Rank.FOUR; +import static cards.Rank.JACK; +import static cards.Rank.KING; +import static cards.Rank.NINE; +import static cards.Rank.QUEEN; +import static cards.Rank.SEVEN; +import static cards.Rank.SIX; +import static cards.Rank.TEN; +import static cards.Rank.THREE; +import static cards.Rank.TWO; +import static org.junit.Assert.assertEquals; + +public class RankTest { + @Test + public void toStringTest() { + assertEquals("2", TWO.toString()); + assertEquals("3", THREE.toString()); + assertEquals("4", FOUR.toString()); + assertEquals("5", FIVE.toString()); + assertEquals("6", SIX.toString()); + assertEquals("7", SEVEN.toString()); + assertEquals("8", EIGHT.toString()); + assertEquals("9", NINE.toString()); + assertEquals("10", TEN.toString()); + assertEquals("J", JACK.toString()); + assertEquals("Q", QUEEN.toString()); + assertEquals("K", KING.toString()); + assertEquals("A", ACE.toString()); + } +} diff --git a/test/cards/SuitTest.java b/test/cards/SuitTest.java new file mode 100644 index 0000000..1020272 --- /dev/null +++ b/test/cards/SuitTest.java @@ -0,0 +1,19 @@ +package cards; + +import org.junit.Test; + +import static cards.Suit.CLUBS; +import static cards.Suit.DIAMONDS; +import static cards.Suit.HEARTS; +import static cards.Suit.SPADES; +import static org.junit.Assert.assertEquals; + +public class SuitTest { + @Test + public void toStringTest() { + assertEquals("♥︎", HEARTS.toString()); + assertEquals("♦︎", DIAMONDS.toString()); + assertEquals("♣︎", CLUBS.toString()); + assertEquals("♠︎", SPADES.toString()); + } +} diff --git a/test/cards/maumau/MauMauDeckTest.java b/test/cards/maumau/MauMauDeckTest.java new file mode 100644 index 0000000..e6e1665 --- /dev/null +++ b/test/cards/maumau/MauMauDeckTest.java @@ -0,0 +1,34 @@ +package cards.maumau; + +import cards.Card; +import cards.Rank; +import cards.Suit; +import org.junit.Test; + +import java.util.List; + +import static cards.Rank.ACE; +import static cards.Rank.SIX; +import static cards.Rank.TEN; +import static cards.Rank.TWO; +import static cards.Suit.DIAMONDS; +import static cards.Suit.HEARTS; +import static cards.Suit.SPADES; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + +public class MauMauDeckTest { + private static Card c(Rank r, Suit s) { + return new Card(r, s); + } + + @Test + public void dealCardsTest() { + final List deck = MauMauDeck.makeDeck(5); + assertEquals(160, deck.size()); + assertFalse(deck.contains(c(TWO, DIAMONDS))); + assertFalse(deck.contains(c(SIX, SPADES))); + assertEquals(5, deck.stream().filter(c -> c.equals(c(TEN, HEARTS))).count()); + assertEquals(5, deck.stream().filter(c -> c.equals(c(ACE, SPADES))).count()); + } +} diff --git a/test/cards/maumau/model/CardHandlerTest.java b/test/cards/maumau/model/CardHandlerTest.java new file mode 100644 index 0000000..e9c74ca --- /dev/null +++ b/test/cards/maumau/model/CardHandlerTest.java @@ -0,0 +1,43 @@ +package cards.maumau.model; + +import cards.Card; +import cards.Rank; +import cards.Suit; +import org.junit.Test; + +import java.util.List; + +import static cards.Rank.ACE; +import static cards.Rank.EIGHT; +import static cards.Rank.JACK; +import static cards.Rank.KING; +import static cards.Rank.NINE; +import static cards.Rank.QUEEN; +import static cards.Rank.SEVEN; +import static cards.Rank.TEN; +import static cards.Suit.CLUBS; +import static cards.Suit.DIAMONDS; +import static cards.Suit.HEARTS; +import static cards.Suit.SPADES; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class CardHandlerTest { + private static Card c(Rank r, Suit s) { + return new Card(r, s); + } + + @Test + public void dealCardsTest() { + final List deck = List.of(c(JACK, DIAMONDS), c(SEVEN, CLUBS), c(QUEEN, DIAMONDS), c(NINE, CLUBS), c(ACE, SPADES), c(NINE, SPADES), c(ACE, DIAMONDS), c(EIGHT, CLUBS), c(EIGHT, DIAMONDS), c(KING, HEARTS), c(ACE, HEARTS), c(SEVEN, SPADES), c(KING, CLUBS), c(KING, SPADES), c(QUEEN, SPADES), c(SEVEN, DIAMONDS), c(TEN, DIAMONDS), c(EIGHT, HEARTS), c(KING, DIAMONDS), c(QUEEN, CLUBS), c(JACK, HEARTS), c(EIGHT, SPADES), c(TEN, CLUBS), c(ACE, CLUBS), c(JACK, CLUBS), c(QUEEN, HEARTS), c(SEVEN, HEARTS), c(JACK, SPADES), c(NINE, DIAMONDS), c(NINE, HEARTS), c(TEN, HEARTS), c(TEN, SPADES)); + final MauMau game = new MauMau(5, deck); + final Player jacqueline = game.addPlayer("Jacqueline"); + final Player chantal = game.addPlayer("Chantal"); + assertTrue(jacqueline.getCards().isEmpty()); + assertTrue(chantal.getCards().isEmpty()); + game.getCardHandler().dealCards(); + assertEquals("[J♦︎, Q♦︎, A♠︎, A♦︎, 8♦︎]", jacqueline.getCards().toString()); + assertEquals("[7♣︎, 9♣︎, 9♠︎, 8♣︎, K♥︎]", chantal.getCards().toString()); + assertEquals(c(ACE, HEARTS), game.getCardHandler().top()); + } +} diff --git a/test/cards/maumau/model/MauMau1Test.java b/test/cards/maumau/model/MauMau1Test.java new file mode 100644 index 0000000..52ba495 --- /dev/null +++ b/test/cards/maumau/model/MauMau1Test.java @@ -0,0 +1,181 @@ +package cards.maumau.model; + +import cards.Card; +import cards.Rank; +import cards.Suit; +import org.junit.Test; + +import java.util.List; + +import static cards.Rank.ACE; +import static cards.Rank.EIGHT; +import static cards.Rank.JACK; +import static cards.Rank.KING; +import static cards.Rank.NINE; +import static cards.Rank.QUEEN; +import static cards.Rank.SEVEN; +import static cards.Rank.TEN; +import static cards.Suit.CLUBS; +import static cards.Suit.DIAMONDS; +import static cards.Suit.HEARTS; +import static cards.Suit.SPADES; +import static cards.maumau.model.GameState.CHOOSE_SUIT; +import static cards.maumau.model.GameState.GAME_INITIALIZED; +import static cards.maumau.model.GameState.GAME_OVER; +import static cards.maumau.model.GameState.PLAY; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class MauMau1Test { + private static Card c(Rank r, Suit s) { + return new Card(r, s); + } + + @Test + public void game() { + final List deck = List.of(c(JACK, DIAMONDS), c(SEVEN, CLUBS), c(QUEEN, DIAMONDS), c(NINE, CLUBS), c(ACE, SPADES), c(NINE, SPADES), c(ACE, DIAMONDS), c(EIGHT, CLUBS), c(EIGHT, DIAMONDS), c(KING, HEARTS), c(ACE, HEARTS), c(SEVEN, SPADES), c(KING, CLUBS), c(KING, SPADES), c(QUEEN, SPADES), c(SEVEN, DIAMONDS), c(TEN, DIAMONDS), c(EIGHT, HEARTS), c(KING, DIAMONDS), c(QUEEN, CLUBS), c(JACK, HEARTS), c(EIGHT, SPADES), c(TEN, CLUBS), c(ACE, CLUBS), c(JACK, CLUBS), c(QUEEN, HEARTS), c(SEVEN, HEARTS), c(JACK, SPADES), c(NINE, DIAMONDS), c(NINE, HEARTS), c(TEN, HEARTS), c(TEN, SPADES)); + final MauMau game = new MauMau(5, deck); + final Player jacqueline = game.addPlayer("Jacqueline"); + final Player chantal = game.addPlayer("Chantal"); + + assertEquals(GAME_INITIALIZED, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[]", jacqueline.getCards().toString()); + assertEquals("[]", chantal.getCards().toString()); + assertEquals("[J♦︎, 7♣︎, Q♦︎, 9♣︎, A♠︎, 9♠︎, A♦︎, 8♣︎, 8♦︎, K♥︎, A♥︎, 7♠︎, K♣︎, K♠︎, Q♠︎, 7♦︎, 10♦︎, 8♥︎, K♦︎, Q♣︎, J♥︎, 8♠︎, 10♣︎, A♣︎, J♣︎, Q♥︎, 7♥︎, J♠︎, 9♦︎, 9♥︎, 10♥︎, 10♠︎]", game.getDrawPile().toString()); + assertEquals("[]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + game.startGame(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[J♦︎, Q♦︎, A♠︎, A♦︎, 8♦︎]", jacqueline.getCards().toString()); + assertEquals("[7♣︎, 9♣︎, 9♠︎, 8♣︎, K♥︎]", chantal.getCards().toString()); + assertEquals("[7♠︎, K♣︎, K♠︎, Q♠︎, 7♦︎, 10♦︎, 8♥︎, K♦︎, Q♣︎, J♥︎, 8♠︎, 10♣︎, A♣︎, J♣︎, Q♥︎, 7♥︎, J♠︎, 9♦︎, 9♥︎, 10♥︎, 10♠︎]", game.getDrawPile().toString()); + assertEquals("[A♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(ACE, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[7♣︎, 9♣︎, 9♠︎, 8♣︎, K♥︎]", chantal.getCards().toString()); + assertEquals("[J♦︎, Q♦︎, A♦︎, 8♦︎]", jacqueline.getCards().toString()); + assertEquals("[7♠︎, K♣︎, K♠︎, Q♠︎, 7♦︎, 10♦︎, 8♥︎, K♦︎, Q♣︎, J♥︎, 8♠︎, 10♣︎, A♣︎, J♣︎, Q♥︎, 7♥︎, J♠︎, 9♦︎, 9♥︎, 10♥︎, 10♠︎]", game.getDrawPile().toString()); + assertEquals("[A♠︎, A♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(NINE, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[J♦︎, Q♦︎, A♦︎, 8♦︎]", jacqueline.getCards().toString()); + assertEquals("[7♣︎, 9♣︎, 8♣︎, K♥︎]", chantal.getCards().toString()); + assertEquals("[7♠︎, K♣︎, K♠︎, Q♠︎, 7♦︎, 10♦︎, 8♥︎, K♦︎, Q♣︎, J♥︎, 8♠︎, 10♣︎, A♣︎, J♣︎, Q♥︎, 7♥︎, J♠︎, 9♦︎, 9♥︎, 10♥︎, 10♠︎]", game.getDrawPile().toString()); + assertEquals("[9♠︎, A♠︎, A♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(JACK, DIAMONDS)); + assertEquals(CHOOSE_SUIT, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[Q♦︎, A♦︎, 8♦︎]", jacqueline.getCards().toString()); + assertEquals("[7♣︎, 9♣︎, 8♣︎, K♥︎]", chantal.getCards().toString()); + assertEquals("[7♠︎, K♣︎, K♠︎, Q♠︎, 7♦︎, 10♦︎, 8♥︎, K♦︎, Q♣︎, J♥︎, 8♠︎, 10♣︎, A♣︎, J♣︎, Q♥︎, 7♥︎, J♠︎, 9♦︎, 9♥︎, 10♥︎, 10♠︎]", game.getDrawPile().toString()); + assertEquals("[J♦︎, 9♠︎, A♠︎, A♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseSuit(DIAMONDS); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[7♣︎, 9♣︎, 8♣︎, K♥︎]", chantal.getCards().toString()); + assertEquals("[Q♦︎, A♦︎, 8♦︎]", jacqueline.getCards().toString()); + assertEquals("[7♠︎, K♣︎, K♠︎, Q♠︎, 7♦︎, 10♦︎, 8♥︎, K♦︎, Q♣︎, J♥︎, 8♠︎, 10♣︎, A♣︎, J♣︎, Q♥︎, 7♥︎, J♠︎, 9♦︎, 9♥︎, 10♥︎, 10♠︎]", game.getDrawPile().toString()); + assertEquals("[J♦︎, 9♠︎, A♠︎, A♥︎]", game.getDiscardPile().toString()); + assertEquals(DIAMONDS, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[Q♦︎, A♦︎, 8♦︎]", jacqueline.getCards().toString()); + assertEquals("[7♣︎, 9♣︎, 8♣︎, K♥︎, 7♠︎]", chantal.getCards().toString()); + assertEquals("[K♣︎, K♠︎, Q♠︎, 7♦︎, 10♦︎, 8♥︎, K♦︎, Q♣︎, J♥︎, 8♠︎, 10♣︎, A♣︎, J♣︎, Q♥︎, 7♥︎, J♠︎, 9♦︎, 9♥︎, 10♥︎, 10♠︎]", game.getDrawPile().toString()); + assertEquals("[J♦︎, 9♠︎, A♠︎, A♥︎]", game.getDiscardPile().toString()); + assertEquals(DIAMONDS, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(EIGHT, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[Q♦︎, A♦︎]", jacqueline.getCards().toString()); + assertEquals("[7♣︎, 9♣︎, 8♣︎, K♥︎, 7♠︎]", chantal.getCards().toString()); + assertEquals("[K♣︎, K♠︎, Q♠︎, 7♦︎, 10♦︎, 8♥︎, K♦︎, Q♣︎, J♥︎, 8♠︎, 10♣︎, A♣︎, J♣︎, Q♥︎, 7♥︎, J♠︎, 9♦︎, 9♥︎, 10♥︎, 10♠︎]", game.getDrawPile().toString()); + assertEquals("[8♦︎, J♦︎, 9♠︎, A♠︎, A♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(QUEEN, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[7♣︎, 9♣︎, 8♣︎, K♥︎, 7♠︎]", chantal.getCards().toString()); + assertEquals("[A♦︎]", jacqueline.getCards().toString()); + assertEquals("[K♣︎, K♠︎, Q♠︎, 7♦︎, 10♦︎, 8♥︎, K♦︎, Q♣︎, J♥︎, 8♠︎, 10♣︎, A♣︎, J♣︎, Q♥︎, 7♥︎, J♠︎, 9♦︎, 9♥︎, 10♥︎, 10♠︎]", game.getDrawPile().toString()); + assertEquals("[Q♦︎, 8♦︎, J♦︎, 9♠︎, A♠︎, A♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.mau(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[7♣︎, 9♣︎, 8♣︎, K♥︎, 7♠︎]", chantal.getCards().toString()); + assertEquals("[A♦︎]", jacqueline.getCards().toString()); + assertEquals("[K♣︎, K♠︎, Q♠︎, 7♦︎, 10♦︎, 8♥︎, K♦︎, Q♣︎, J♥︎, 8♠︎, 10♣︎, A♣︎, J♣︎, Q♥︎, 7♥︎, J♠︎, 9♦︎, 9♥︎, 10♥︎, 10♠︎]", game.getDrawPile().toString()); + assertEquals("[Q♦︎, 8♦︎, J♦︎, 9♠︎, A♠︎, A♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[A♦︎]", jacqueline.getCards().toString()); + assertEquals("[7♣︎, 9♣︎, 8♣︎, K♥︎, 7♠︎, K♣︎]", chantal.getCards().toString()); + assertEquals("[K♠︎, Q♠︎, 7♦︎, 10♦︎, 8♥︎, K♦︎, Q♣︎, J♥︎, 8♠︎, 10♣︎, A♣︎, J♣︎, Q♥︎, 7♥︎, J♠︎, 9♦︎, 9♥︎, 10♥︎, 10♠︎]", game.getDrawPile().toString()); + assertEquals("[Q♦︎, 8♦︎, J♦︎, 9♠︎, A♠︎, A♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(ACE, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[7♣︎, 9♣︎, 8♣︎, K♥︎, 7♠︎, K♣︎]", chantal.getCards().toString()); + assertEquals("[]", jacqueline.getCards().toString()); + assertEquals("[K♠︎, Q♠︎, 7♦︎, 10♦︎, 8♥︎, K♦︎, Q♣︎, J♥︎, 8♠︎, 10♣︎, A♣︎, J♣︎, Q♥︎, 7♥︎, J♠︎, 9♦︎, 9♥︎, 10♥︎, 10♠︎]", game.getDrawPile().toString()); + assertEquals("[A♦︎, Q♦︎, 8♦︎, J♦︎, 9♠︎, A♠︎, A♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.maumau(); + assertEquals(GAME_OVER, game.getGameState()); + assertEquals(List.of(), game.getPlayers()); + assertEquals(List.of(jacqueline, chantal), game.getRanking()); + assertEquals("[K♠︎, Q♠︎, 7♦︎, 10♦︎, 8♥︎, K♦︎, Q♣︎, J♥︎, 8♠︎, 10♣︎, A♣︎, J♣︎, Q♥︎, 7♥︎, J♠︎, 9♦︎, 9♥︎, 10♥︎, 10♠︎]", game.getDrawPile().toString()); + assertEquals("[A♦︎, Q♦︎, 8♦︎, J♦︎, 9♠︎, A♠︎, A♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + } +} diff --git a/test/cards/maumau/model/MauMau2Test.java b/test/cards/maumau/model/MauMau2Test.java new file mode 100644 index 0000000..29aafc0 --- /dev/null +++ b/test/cards/maumau/model/MauMau2Test.java @@ -0,0 +1,246 @@ +package cards.maumau.model; + +import cards.Card; +import cards.Rank; +import cards.Suit; +import org.junit.Test; + +import java.util.List; + +import static cards.Rank.ACE; +import static cards.Rank.EIGHT; +import static cards.Rank.JACK; +import static cards.Rank.KING; +import static cards.Rank.NINE; +import static cards.Rank.QUEEN; +import static cards.Rank.SEVEN; +import static cards.Rank.TEN; +import static cards.Suit.CLUBS; +import static cards.Suit.DIAMONDS; +import static cards.Suit.HEARTS; +import static cards.Suit.SPADES; +import static cards.maumau.model.GameState.GAME_INITIALIZED; +import static cards.maumau.model.GameState.GAME_OVER; +import static cards.maumau.model.GameState.PLAY; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class MauMau2Test { + private static Card c(Rank r, Suit s) { + return new Card(r, s); + } + + @Test + public void game() { + final List deck = List.of(c(KING, SPADES), c(QUEEN, DIAMONDS), c(EIGHT, DIAMONDS), c(ACE, SPADES), c(TEN, SPADES), c(EIGHT, HEARTS), c(QUEEN, SPADES), c(ACE, DIAMONDS), c(KING, DIAMONDS), c(SEVEN, SPADES), c(TEN, CLUBS), c(ACE, HEARTS), c(QUEEN, CLUBS), c(NINE, HEARTS), c(KING, CLUBS), c(SEVEN, CLUBS), c(JACK, DIAMONDS), c(NINE, DIAMONDS), c(ACE, CLUBS), c(EIGHT, SPADES), c(TEN, DIAMONDS), c(JACK, SPADES), c(JACK, HEARTS), c(JACK, CLUBS), c(TEN, HEARTS), c(KING, HEARTS), c(QUEEN, HEARTS), c(SEVEN, HEARTS), c(SEVEN, DIAMONDS), c(EIGHT, CLUBS), c(NINE, CLUBS), c(NINE, SPADES)); + final MauMau game = new MauMau(5, deck); + final Player jacqueline = game.addPlayer("Jacqueline"); + final Player chantal = game.addPlayer("Chantal"); + + assertEquals(GAME_INITIALIZED, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[]", jacqueline.getCards().toString()); + assertEquals("[]", chantal.getCards().toString()); + assertEquals("[K♠︎, Q♦︎, 8♦︎, A♠︎, 10♠︎, 8♥︎, Q♠︎, A♦︎, K♦︎, 7♠︎, 10♣︎, A♥︎, Q♣︎, 9♥︎, K♣︎, 7♣︎, J♦︎, 9♦︎, A♣︎, 8♠︎, 10♦︎, J♠︎, J♥︎, J♣︎, 10♥︎, K♥︎, Q♥︎, 7♥︎, 7♦︎, 8♣︎, 9♣︎, 9♠︎]", game.getDrawPile().toString()); + assertEquals("[]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + game.startGame(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[K♠︎, 8♦︎, 10♠︎, Q♠︎, K♦︎]", jacqueline.getCards().toString()); + assertEquals("[Q♦︎, A♠︎, 8♥︎, A♦︎, 7♠︎]", chantal.getCards().toString()); + assertEquals("[A♥︎, Q♣︎, 9♥︎, K♣︎, 7♣︎, J♦︎, 9♦︎, A♣︎, 8♠︎, 10♦︎, J♠︎, J♥︎, J♣︎, 10♥︎, K♥︎, Q♥︎, 7♥︎, 7♦︎, 8♣︎, 9♣︎, 9♠︎]", game.getDrawPile().toString()); + assertEquals("[10♣︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(TEN, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[Q♦︎, A♠︎, 8♥︎, A♦︎, 7♠︎]", chantal.getCards().toString()); + assertEquals("[K♠︎, 8♦︎, Q♠︎, K♦︎]", jacqueline.getCards().toString()); + assertEquals("[A♥︎, Q♣︎, 9♥︎, K♣︎, 7♣︎, J♦︎, 9♦︎, A♣︎, 8♠︎, 10♦︎, J♠︎, J♥︎, J♣︎, 10♥︎, K♥︎, Q♥︎, 7♥︎, 7♦︎, 8♣︎, 9♣︎, 9♠︎]", game.getDrawPile().toString()); + assertEquals("[10♠︎, 10♣︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(SEVEN, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[K♠︎, 8♦︎, Q♠︎, K♦︎]", jacqueline.getCards().toString()); + assertEquals("[Q♦︎, A♠︎, 8♥︎, A♦︎]", chantal.getCards().toString()); + assertEquals("[A♥︎, Q♣︎, 9♥︎, K♣︎, 7♣︎, J♦︎, 9♦︎, A♣︎, 8♠︎, 10♦︎, J♠︎, J♥︎, J♣︎, 10♥︎, K♥︎, Q♥︎, 7♥︎, 7♦︎, 8♣︎, 9♣︎, 9♠︎]", game.getDrawPile().toString()); + assertEquals("[7♠︎, 10♠︎, 10♣︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(1, game.get7Counter()); + + jacqueline.no7(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[K♠︎, 8♦︎, Q♠︎, K♦︎, A♥︎, Q♣︎]", jacqueline.getCards().toString()); + assertEquals("[Q♦︎, A♠︎, 8♥︎, A♦︎]", chantal.getCards().toString()); + assertEquals("[9♥︎, K♣︎, 7♣︎, J♦︎, 9♦︎, A♣︎, 8♠︎, 10♦︎, J♠︎, J♥︎, J♣︎, 10♥︎, K♥︎, Q♥︎, 7♥︎, 7♦︎, 8♣︎, 9♣︎, 9♠︎]", game.getDrawPile().toString()); + assertEquals("[7♠︎, 10♠︎, 10♣︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(EIGHT, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[K♠︎, 8♦︎, Q♠︎, K♦︎, A♥︎, Q♣︎]", jacqueline.getCards().toString()); + assertEquals("[Q♦︎, A♠︎, 8♥︎, A♦︎]", chantal.getCards().toString()); + assertEquals("[9♥︎, K♣︎, 7♣︎, J♦︎, 9♦︎, A♣︎, 8♠︎, 10♦︎, J♠︎, J♥︎, J♣︎, 10♥︎, K♥︎, Q♥︎, 7♥︎, 7♦︎, 8♣︎, 9♣︎, 9♠︎]", game.getDrawPile().toString()); + assertEquals("[7♠︎, 10♠︎, 10♣︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(KING, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[Q♦︎, A♠︎, 8♥︎, A♦︎]", chantal.getCards().toString()); + assertEquals("[8♦︎, Q♠︎, K♦︎, A♥︎, Q♣︎]", jacqueline.getCards().toString()); + assertEquals("[9♥︎, K♣︎, 7♣︎, J♦︎, 9♦︎, A♣︎, 8♠︎, 10♦︎, J♠︎, J♥︎, J♣︎, 10♥︎, K♥︎, Q♥︎, 7♥︎, 7♦︎, 8♣︎, 9♣︎, 9♠︎]", game.getDrawPile().toString()); + assertEquals("[K♠︎, 7♠︎, 10♠︎, 10♣︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(ACE, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♦︎, Q♠︎, K♦︎, A♥︎, Q♣︎]", jacqueline.getCards().toString()); + assertEquals("[Q♦︎, 8♥︎, A♦︎]", chantal.getCards().toString()); + assertEquals("[9♥︎, K♣︎, 7♣︎, J♦︎, 9♦︎, A♣︎, 8♠︎, 10♦︎, J♠︎, J♥︎, J♣︎, 10♥︎, K♥︎, Q♥︎, 7♥︎, 7♦︎, 8♣︎, 9♣︎, 9♠︎]", game.getDrawPile().toString()); + assertEquals("[A♠︎, K♠︎, 7♠︎, 10♠︎, 10♣︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(ACE, HEARTS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[Q♦︎, 8♥︎, A♦︎]", chantal.getCards().toString()); + assertEquals("[8♦︎, Q♠︎, K♦︎, Q♣︎]", jacqueline.getCards().toString()); + assertEquals("[9♥︎, K♣︎, 7♣︎, J♦︎, 9♦︎, A♣︎, 8♠︎, 10♦︎, J♠︎, J♥︎, J♣︎, 10♥︎, K♥︎, Q♥︎, 7♥︎, 7♦︎, 8♣︎, 9♣︎, 9♠︎]", game.getDrawPile().toString()); + assertEquals("[A♥︎, A♠︎, K♠︎, 7♠︎, 10♠︎, 10♣︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(ACE, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♦︎, Q♠︎, K♦︎, Q♣︎]", jacqueline.getCards().toString()); + assertEquals("[Q♦︎, 8♥︎]", chantal.getCards().toString()); + assertEquals("[9♥︎, K♣︎, 7♣︎, J♦︎, 9♦︎, A♣︎, 8♠︎, 10♦︎, J♠︎, J♥︎, J♣︎, 10♥︎, K♥︎, Q♥︎, 7♥︎, 7♦︎, 8♣︎, 9♣︎, 9♠︎]", game.getDrawPile().toString()); + assertEquals("[A♦︎, A♥︎, A♠︎, K♠︎, 7♠︎, 10♠︎, 10♣︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(EIGHT, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[Q♠︎, K♦︎, Q♣︎]", jacqueline.getCards().toString()); + assertEquals("[Q♦︎, 8♥︎]", chantal.getCards().toString()); + assertEquals("[9♥︎, K♣︎, 7♣︎, J♦︎, 9♦︎, A♣︎, 8♠︎, 10♦︎, J♠︎, J♥︎, J♣︎, 10♥︎, K♥︎, Q♥︎, 7♥︎, 7♦︎, 8♣︎, 9♣︎, 9♠︎]", game.getDrawPile().toString()); + assertEquals("[8♦︎, A♦︎, A♥︎, A♠︎, K♠︎, 7♠︎, 10♠︎, 10♣︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(KING, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[Q♦︎, 8♥︎]", chantal.getCards().toString()); + assertEquals("[Q♠︎, Q♣︎]", jacqueline.getCards().toString()); + assertEquals("[9♥︎, K♣︎, 7♣︎, J♦︎, 9♦︎, A♣︎, 8♠︎, 10♦︎, J♠︎, J♥︎, J♣︎, 10♥︎, K♥︎, Q♥︎, 7♥︎, 7♦︎, 8♣︎, 9♣︎, 9♠︎]", game.getDrawPile().toString()); + assertEquals("[K♦︎, 8♦︎, A♦︎, A♥︎, A♠︎, K♠︎, 7♠︎, 10♠︎, 10♣︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(QUEEN, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[Q♠︎, Q♣︎]", jacqueline.getCards().toString()); + assertEquals("[8♥︎]", chantal.getCards().toString()); + assertEquals("[9♥︎, K♣︎, 7♣︎, J♦︎, 9♦︎, A♣︎, 8♠︎, 10♦︎, J♠︎, J♥︎, J♣︎, 10♥︎, K♥︎, Q♥︎, 7♥︎, 7♦︎, 8♣︎, 9♣︎, 9♠︎]", game.getDrawPile().toString()); + assertEquals("[Q♦︎, K♦︎, 8♦︎, A♦︎, A♥︎, A♠︎, K♠︎, 7♠︎, 10♠︎, 10♣︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.mau(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[Q♠︎, Q♣︎]", jacqueline.getCards().toString()); + assertEquals("[8♥︎]", chantal.getCards().toString()); + assertEquals("[9♥︎, K♣︎, 7♣︎, J♦︎, 9♦︎, A♣︎, 8♠︎, 10♦︎, J♠︎, J♥︎, J♣︎, 10♥︎, K♥︎, Q♥︎, 7♥︎, 7♦︎, 8♣︎, 9♣︎, 9♠︎]", game.getDrawPile().toString()); + assertEquals("[Q♦︎, K♦︎, 8♦︎, A♦︎, A♥︎, A♠︎, K♠︎, 7♠︎, 10♠︎, 10♣︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(QUEEN, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♥︎]", chantal.getCards().toString()); + assertEquals("[Q♣︎]", jacqueline.getCards().toString()); + assertEquals("[9♥︎, K♣︎, 7♣︎, J♦︎, 9♦︎, A♣︎, 8♠︎, 10♦︎, J♠︎, J♥︎, J♣︎, 10♥︎, K♥︎, Q♥︎, 7♥︎, 7♦︎, 8♣︎, 9♣︎, 9♠︎]", game.getDrawPile().toString()); + assertEquals("[Q♠︎, Q♦︎, K♦︎, 8♦︎, A♦︎, A♥︎, A♠︎, K♠︎, 7♠︎, 10♠︎, 10♣︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.mau(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♥︎]", chantal.getCards().toString()); + assertEquals("[Q♣︎]", jacqueline.getCards().toString()); + assertEquals("[9♥︎, K♣︎, 7♣︎, J♦︎, 9♦︎, A♣︎, 8♠︎, 10♦︎, J♠︎, J♥︎, J♣︎, 10♥︎, K♥︎, Q♥︎, 7♥︎, 7♦︎, 8♣︎, 9♣︎, 9♠︎]", game.getDrawPile().toString()); + assertEquals("[Q♠︎, Q♦︎, K♦︎, 8♦︎, A♦︎, A♥︎, A♠︎, K♠︎, 7♠︎, 10♠︎, 10♣︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[Q♣︎]", jacqueline.getCards().toString()); + assertEquals("[8♥︎, 9♥︎]", chantal.getCards().toString()); + assertEquals("[K♣︎, 7♣︎, J♦︎, 9♦︎, A♣︎, 8♠︎, 10♦︎, J♠︎, J♥︎, J♣︎, 10♥︎, K♥︎, Q♥︎, 7♥︎, 7♦︎, 8♣︎, 9♣︎, 9♠︎]", game.getDrawPile().toString()); + assertEquals("[Q♠︎, Q♦︎, K♦︎, 8♦︎, A♦︎, A♥︎, A♠︎, K♠︎, 7♠︎, 10♠︎, 10♣︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(QUEEN, CLUBS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♥︎, 9♥︎]", chantal.getCards().toString()); + assertEquals("[]", jacqueline.getCards().toString()); + assertEquals("[K♣︎, 7♣︎, J♦︎, 9♦︎, A♣︎, 8♠︎, 10♦︎, J♠︎, J♥︎, J♣︎, 10♥︎, K♥︎, Q♥︎, 7♥︎, 7♦︎, 8♣︎, 9♣︎, 9♠︎]", game.getDrawPile().toString()); + assertEquals("[Q♣︎, Q♠︎, Q♦︎, K♦︎, 8♦︎, A♦︎, A♥︎, A♠︎, K♠︎, 7♠︎, 10♠︎, 10♣︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.maumau(); + assertEquals(GAME_OVER, game.getGameState()); + assertEquals(List.of(), game.getPlayers()); + assertEquals(List.of(jacqueline, chantal), game.getRanking()); + assertEquals("[K♣︎, 7♣︎, J♦︎, 9♦︎, A♣︎, 8♠︎, 10♦︎, J♠︎, J♥︎, J♣︎, 10♥︎, K♥︎, Q♥︎, 7♥︎, 7♦︎, 8♣︎, 9♣︎, 9♠︎]", game.getDrawPile().toString()); + assertEquals("[Q♣︎, Q♠︎, Q♦︎, K♦︎, 8♦︎, A♦︎, A♥︎, A♠︎, K♠︎, 7♠︎, 10♠︎, 10♣︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + } +} \ No newline at end of file diff --git a/test/cards/maumau/model/MauMau3Test.java b/test/cards/maumau/model/MauMau3Test.java new file mode 100644 index 0000000..612bcfd --- /dev/null +++ b/test/cards/maumau/model/MauMau3Test.java @@ -0,0 +1,173 @@ +package cards.maumau.model; + +import cards.Card; +import cards.Rank; +import cards.Suit; +import org.junit.Test; + +import java.util.List; + +import static cards.Rank.ACE; +import static cards.Rank.KING; +import static cards.Rank.QUEEN; +import static cards.Rank.SEVEN; +import static cards.Rank.TEN; +import static cards.Suit.CLUBS; +import static cards.Suit.DIAMONDS; +import static cards.Suit.HEARTS; +import static cards.Suit.SPADES; +import static cards.maumau.model.GameState.GAME_CANCELED; +import static cards.maumau.model.GameState.GAME_INITIALIZED; +import static cards.maumau.model.GameState.PLAY; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class MauMau3Test { + private static Card c(Rank r, Suit s) { + return new Card(r, s); + } + + @Test + public void game() { + final List deck = List.of(c(SEVEN, SPADES), c(SEVEN, DIAMONDS), c(SEVEN, DIAMONDS), c(SEVEN, SPADES), c(SEVEN, SPADES), c(SEVEN, HEARTS), c(SEVEN, SPADES), c(ACE, DIAMONDS), c(KING, DIAMONDS), c(SEVEN, SPADES), c(TEN, HEARTS), c(ACE, HEARTS), c(QUEEN, CLUBS)); + final MauMau game = new MauMau(5, deck); + final Player jacqueline = game.addPlayer("Jacqueline"); + final Player chantal = game.addPlayer("Chantal"); + + assertEquals(GAME_INITIALIZED, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[]", jacqueline.getCards().toString()); + assertEquals("[]", chantal.getCards().toString()); + assertEquals("[7♠︎, 7♦︎, 7♦︎, 7♠︎, 7♠︎, 7♥︎, 7♠︎, A♦︎, K♦︎, 7♠︎, 10♥︎, A♥︎, Q♣︎]", game.getDrawPile().toString()); + assertEquals("[]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + game.startGame(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[7♠︎, 7♦︎, 7♠︎, 7♠︎, K♦︎]", jacqueline.getCards().toString()); + assertEquals("[7♦︎, 7♠︎, 7♥︎, A♦︎, 7♠︎]", chantal.getCards().toString()); + assertEquals("[A♥︎, Q♣︎]", game.getDrawPile().toString()); + assertEquals("[10♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[7♦︎, 7♠︎, 7♥︎, A♦︎, 7♠︎]", chantal.getCards().toString()); + assertEquals("[7♠︎, 7♦︎, 7♠︎, 7♠︎, K♦︎, A♥︎]", jacqueline.getCards().toString()); + assertEquals("[Q♣︎]", game.getDrawPile().toString()); + assertEquals("[10♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(SEVEN, HEARTS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[7♠︎, 7♦︎, 7♠︎, 7♠︎, K♦︎, A♥︎]", jacqueline.getCards().toString()); + assertEquals("[7♦︎, 7♠︎, A♦︎, 7♠︎]", chantal.getCards().toString()); + assertEquals("[Q♣︎]", game.getDrawPile().toString()); + assertEquals("[7♥︎, 10♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(1, game.get7Counter()); + + jacqueline.chooseCard(c(SEVEN, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[7♦︎, 7♠︎, A♦︎, 7♠︎]", chantal.getCards().toString()); + assertEquals("[7♠︎, 7♠︎, 7♠︎, K♦︎, A♥︎]", jacqueline.getCards().toString()); + assertEquals("[Q♣︎]", game.getDrawPile().toString()); + assertEquals("[7♦︎, 7♥︎, 10♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(2, game.get7Counter()); + + chantal.chooseCard(c(SEVEN, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[7♠︎, 7♠︎, 7♠︎, K♦︎, A♥︎]", jacqueline.getCards().toString()); + assertEquals("[7♠︎, A♦︎, 7♠︎]", chantal.getCards().toString()); + assertEquals("[Q♣︎]", game.getDrawPile().toString()); + assertEquals("[7♦︎, 7♦︎, 7♥︎, 10♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(3, game.get7Counter()); + + jacqueline.chooseCard(c(SEVEN, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[7♠︎, A♦︎, 7♠︎]", chantal.getCards().toString()); + assertEquals("[7♠︎, 7♠︎, K♦︎, A♥︎]", jacqueline.getCards().toString()); + assertEquals("[Q♣︎]", game.getDrawPile().toString()); + assertEquals("[7♠︎, 7♦︎, 7♦︎, 7♥︎, 10♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(4, game.get7Counter()); + + chantal.chooseCard(c(SEVEN, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[7♠︎, 7♠︎, K♦︎, A♥︎]", jacqueline.getCards().toString()); + assertEquals("[A♦︎, 7♠︎]", chantal.getCards().toString()); + assertEquals("[Q♣︎]", game.getDrawPile().toString()); + assertEquals("[7♠︎, 7♠︎, 7♦︎, 7♦︎, 7♥︎, 10♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(5, game.get7Counter()); + + jacqueline.chooseCard(c(SEVEN, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[A♦︎, 7♠︎]", chantal.getCards().toString()); + assertEquals("[7♠︎, K♦︎, A♥︎]", jacqueline.getCards().toString()); + assertEquals("[Q♣︎]", game.getDrawPile().toString()); + assertEquals("[7♠︎, 7♠︎, 7♠︎, 7♦︎, 7♦︎, 7♥︎, 10♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(6, game.get7Counter()); + + chantal.chooseCard(c(SEVEN, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[7♠︎, K♦︎, A♥︎]", jacqueline.getCards().toString()); + assertEquals("[A♦︎]", chantal.getCards().toString()); + assertEquals("[Q♣︎]", game.getDrawPile().toString()); + assertEquals("[7♠︎, 7♠︎, 7♠︎, 7♠︎, 7♦︎, 7♦︎, 7♥︎, 10♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(7, game.get7Counter()); + + chantal.mau(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[7♠︎, K♦︎, A♥︎]", jacqueline.getCards().toString()); + assertEquals("[A♦︎]", chantal.getCards().toString()); + assertEquals("[Q♣︎]", game.getDrawPile().toString()); + assertEquals("[7♠︎, 7♠︎, 7♠︎, 7♠︎, 7♦︎, 7♦︎, 7♥︎, 10♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(7, game.get7Counter()); + + jacqueline.chooseCard(c(SEVEN, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[A♦︎]", chantal.getCards().toString()); + assertEquals("[K♦︎, A♥︎]", jacqueline.getCards().toString()); + assertEquals("[Q♣︎]", game.getDrawPile().toString()); + assertEquals("[7♠︎, 7♠︎, 7♠︎, 7♠︎, 7♠︎, 7♦︎, 7♦︎, 7♥︎, 10♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(8, game.get7Counter()); + + chantal.no7(); + assertEquals(GAME_CANCELED, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + } +} \ No newline at end of file diff --git a/test/cards/maumau/model/MauMau4Test.java b/test/cards/maumau/model/MauMau4Test.java new file mode 100644 index 0000000..aedd9cb --- /dev/null +++ b/test/cards/maumau/model/MauMau4Test.java @@ -0,0 +1,368 @@ +package cards.maumau.model; + +import cards.Card; +import cards.Rank; +import cards.Suit; +import org.junit.Test; + +import java.util.List; + +import static cards.Rank.ACE; +import static cards.Rank.EIGHT; +import static cards.Rank.JACK; +import static cards.Rank.KING; +import static cards.Rank.NINE; +import static cards.Rank.QUEEN; +import static cards.Rank.SEVEN; +import static cards.Rank.TEN; +import static cards.Suit.CLUBS; +import static cards.Suit.DIAMONDS; +import static cards.Suit.HEARTS; +import static cards.Suit.SPADES; +import static cards.maumau.model.GameState.CHOOSE_SUIT; +import static cards.maumau.model.GameState.GAME_INITIALIZED; +import static cards.maumau.model.GameState.GAME_OVER; +import static cards.maumau.model.GameState.PLAY; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class MauMau4Test { + private static Card c(Rank r, Suit s) { + return new Card(r, s); + } + + @Test + public void game() { + final List deck = List.of(c(TEN, DIAMONDS), c(KING, DIAMONDS), c(JACK, CLUBS), c(TEN, SPADES), c(EIGHT, SPADES), c(JACK, HEARTS), c(SEVEN, DIAMONDS), c(JACK, SPADES), c(SEVEN, SPADES), c(QUEEN, SPADES), c(KING, SPADES), c(NINE, CLUBS), c(QUEEN, CLUBS), c(EIGHT, CLUBS), c(NINE, SPADES), c(TEN, CLUBS), c(ACE, HEARTS), c(SEVEN, HEARTS), c(NINE, DIAMONDS), c(EIGHT, HEARTS), c(SEVEN, CLUBS), c(QUEEN, DIAMONDS), c(ACE, SPADES), c(KING, HEARTS), c(QUEEN, HEARTS), c(EIGHT, DIAMONDS), c(ACE, CLUBS), c(TEN, HEARTS), c(JACK, DIAMONDS), c(NINE, HEARTS), c(KING, CLUBS), c(ACE, DIAMONDS)); + final MauMau game = new MauMau(5, deck); + final Player jacqueline = game.addPlayer("Jacqueline"); + final Player chantal = game.addPlayer("Chantal"); + + assertEquals(GAME_INITIALIZED, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[]", jacqueline.getCards().toString()); + assertEquals("[]", chantal.getCards().toString()); + assertEquals("[10♦︎, K♦︎, J♣︎, 10♠︎, 8♠︎, J♥︎, 7♦︎, J♠︎, 7♠︎, Q♠︎, K♠︎, 9♣︎, Q♣︎, 8♣︎, 9♠︎, 10♣︎, A♥︎, 7♥︎, 9♦︎, 8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + game.startGame(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[10♦︎, J♣︎, 8♠︎, 7♦︎, 7♠︎]", jacqueline.getCards().toString()); + assertEquals("[K♦︎, 10♠︎, J♥︎, J♠︎, Q♠︎]", chantal.getCards().toString()); + assertEquals("[9♣︎, Q♣︎, 8♣︎, 9♠︎, 10♣︎, A♥︎, 7♥︎, 9♦︎, 8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[K♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(SEVEN, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[K♦︎, 10♠︎, J♥︎, J♠︎, Q♠︎]", chantal.getCards().toString()); + assertEquals("[10♦︎, J♣︎, 8♠︎, 7♦︎]", jacqueline.getCards().toString()); + assertEquals("[9♣︎, Q♣︎, 8♣︎, 9♠︎, 10♣︎, A♥︎, 7♥︎, 9♦︎, 8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[7♠︎, K♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(1, game.get7Counter()); + + chantal.no7(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[K♦︎, 10♠︎, J♥︎, J♠︎, Q♠︎, 9♣︎, Q♣︎]", chantal.getCards().toString()); + assertEquals("[10♦︎, J♣︎, 8♠︎, 7♦︎]", jacqueline.getCards().toString()); + assertEquals("[8♣︎, 9♠︎, 10♣︎, A♥︎, 7♥︎, 9♦︎, 8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[7♠︎, K♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(TEN, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[10♦︎, J♣︎, 8♠︎, 7♦︎]", jacqueline.getCards().toString()); + assertEquals("[K♦︎, J♥︎, J♠︎, Q♠︎, 9♣︎, Q♣︎]", chantal.getCards().toString()); + assertEquals("[8♣︎, 9♠︎, 10♣︎, A♥︎, 7♥︎, 9♦︎, 8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[10♠︎, 7♠︎, K♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(EIGHT, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[10♦︎, J♣︎, 7♦︎]", jacqueline.getCards().toString()); + assertEquals("[K♦︎, J♥︎, J♠︎, Q♠︎, 9♣︎, Q♣︎]", chantal.getCards().toString()); + assertEquals("[8♣︎, 9♠︎, 10♣︎, A♥︎, 7♥︎, 9♦︎, 8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[8♠︎, 10♠︎, 7♠︎, K♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(JACK, CLUBS)); + assertEquals(CHOOSE_SUIT, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[10♦︎, 7♦︎]", jacqueline.getCards().toString()); + assertEquals("[K♦︎, J♥︎, J♠︎, Q♠︎, 9♣︎, Q♣︎]", chantal.getCards().toString()); + assertEquals("[8♣︎, 9♠︎, 10♣︎, A♥︎, 7♥︎, 9♦︎, 8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[J♣︎, 8♠︎, 10♠︎, 7♠︎, K♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseSuit(DIAMONDS); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[K♦︎, J♥︎, J♠︎, Q♠︎, 9♣︎, Q♣︎]", chantal.getCards().toString()); + assertEquals("[10♦︎, 7♦︎]", jacqueline.getCards().toString()); + assertEquals("[8♣︎, 9♠︎, 10♣︎, A♥︎, 7♥︎, 9♦︎, 8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[J♣︎, 8♠︎, 10♠︎, 7♠︎, K♠︎]", game.getDiscardPile().toString()); + assertEquals(DIAMONDS, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(JACK, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[K♦︎, J♥︎, J♠︎, Q♠︎, 9♣︎, Q♣︎]", chantal.getCards().toString()); + assertEquals("[10♦︎, 7♦︎]", jacqueline.getCards().toString()); + assertEquals("[8♣︎, 9♠︎, 10♣︎, A♥︎, 7♥︎, 9♦︎, 8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[J♣︎, 8♠︎, 10♠︎, 7♠︎, K♠︎]", game.getDiscardPile().toString()); + assertEquals(DIAMONDS, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(KING, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[10♦︎, 7♦︎]", jacqueline.getCards().toString()); + assertEquals("[J♥︎, J♠︎, Q♠︎, 9♣︎, Q♣︎]", chantal.getCards().toString()); + assertEquals("[8♣︎, 9♠︎, 10♣︎, A♥︎, 7♥︎, 9♦︎, 8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[K♦︎, J♣︎, 8♠︎, 10♠︎, 7♠︎, K♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(SEVEN, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[J♥︎, J♠︎, Q♠︎, 9♣︎, Q♣︎]", chantal.getCards().toString()); + assertEquals("[10♦︎]", jacqueline.getCards().toString()); + assertEquals("[8♣︎, 9♠︎, 10♣︎, A♥︎, 7♥︎, 9♦︎, 8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[7♦︎, K♦︎, J♣︎, 8♠︎, 10♠︎, 7♠︎, K♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(1, game.get7Counter()); + + jacqueline.mau(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[J♥︎, J♠︎, Q♠︎, 9♣︎, Q♣︎]", chantal.getCards().toString()); + assertEquals("[10♦︎]", jacqueline.getCards().toString()); + assertEquals("[8♣︎, 9♠︎, 10♣︎, A♥︎, 7♥︎, 9♦︎, 8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[7♦︎, K♦︎, J♣︎, 8♠︎, 10♠︎, 7♠︎, K♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(1, game.get7Counter()); + + chantal.no7(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[J♥︎, J♠︎, Q♠︎, 9♣︎, Q♣︎, 8♣︎, 9♠︎]", chantal.getCards().toString()); + assertEquals("[10♦︎]", jacqueline.getCards().toString()); + assertEquals("[10♣︎, A♥︎, 7♥︎, 9♦︎, 8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[7♦︎, K♦︎, J♣︎, 8♠︎, 10♠︎, 7♠︎, K♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(JACK, HEARTS)); + assertEquals(CHOOSE_SUIT, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[J♠︎, Q♠︎, 9♣︎, Q♣︎, 8♣︎, 9♠︎]", chantal.getCards().toString()); + assertEquals("[10♦︎]", jacqueline.getCards().toString()); + assertEquals("[10♣︎, A♥︎, 7♥︎, 9♦︎, 8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[J♥︎, 7♦︎, K♦︎, J♣︎, 8♠︎, 10♠︎, 7♠︎, K♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseSuit(CLUBS); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[10♦︎]", jacqueline.getCards().toString()); + assertEquals("[J♠︎, Q♠︎, 9♣︎, Q♣︎, 8♣︎, 9♠︎]", chantal.getCards().toString()); + assertEquals("[10♣︎, A♥︎, 7♥︎, 9♦︎, 8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[J♥︎, 7♦︎, K♦︎, J♣︎, 8♠︎, 10♠︎, 7♠︎, K♠︎]", game.getDiscardPile().toString()); + assertEquals(CLUBS, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[J♠︎, Q♠︎, 9♣︎, Q♣︎, 8♣︎, 9♠︎]", chantal.getCards().toString()); + assertEquals("[10♦︎, 10♣︎]", jacqueline.getCards().toString()); + assertEquals("[A♥︎, 7♥︎, 9♦︎, 8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[J♥︎, 7♦︎, K♦︎, J♣︎, 8♠︎, 10♠︎, 7♠︎, K♠︎]", game.getDiscardPile().toString()); + assertEquals(CLUBS, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(EIGHT, CLUBS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[J♠︎, Q♠︎, 9♣︎, Q♣︎, 9♠︎]", chantal.getCards().toString()); + assertEquals("[10♦︎, 10♣︎]", jacqueline.getCards().toString()); + assertEquals("[A♥︎, 7♥︎, 9♦︎, 8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[8♣︎, J♥︎, 7♦︎, K♦︎, J♣︎, 8♠︎, 10♠︎, 7♠︎, K♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(NINE, CLUBS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[10♦︎, 10♣︎]", jacqueline.getCards().toString()); + assertEquals("[J♠︎, Q♠︎, Q♣︎, 9♠︎]", chantal.getCards().toString()); + assertEquals("[A♥︎, 7♥︎, 9♦︎, 8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[9♣︎, 8♣︎, J♥︎, 7♦︎, K♦︎, J♣︎, 8♠︎, 10♠︎, 7♠︎, K♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(TEN, CLUBS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[J♠︎, Q♠︎, Q♣︎, 9♠︎]", chantal.getCards().toString()); + assertEquals("[10♦︎]", jacqueline.getCards().toString()); + assertEquals("[A♥︎, 7♥︎, 9♦︎, 8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[10♣︎, 9♣︎, 8♣︎, J♥︎, 7♦︎, K♦︎, J♣︎, 8♠︎, 10♠︎, 7♠︎, K♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.mau(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[J♠︎, Q♠︎, Q♣︎, 9♠︎]", chantal.getCards().toString()); + assertEquals("[10♦︎]", jacqueline.getCards().toString()); + assertEquals("[A♥︎, 7♥︎, 9♦︎, 8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[10♣︎, 9♣︎, 8♣︎, J♥︎, 7♦︎, K♦︎, J♣︎, 8♠︎, 10♠︎, 7♠︎, K♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(QUEEN, CLUBS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[10♦︎]", jacqueline.getCards().toString()); + assertEquals("[J♠︎, Q♠︎, 9♠︎]", chantal.getCards().toString()); + assertEquals("[A♥︎, 7♥︎, 9♦︎, 8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[Q♣︎, 10♣︎, 9♣︎, 8♣︎, J♥︎, 7♦︎, K♦︎, J♣︎, 8♠︎, 10♠︎, 7♠︎, K♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[J♠︎, Q♠︎, 9♠︎]", chantal.getCards().toString()); + assertEquals("[10♦︎, A♥︎]", jacqueline.getCards().toString()); + assertEquals("[7♥︎, 9♦︎, 8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[Q♣︎, 10♣︎, 9♣︎, 8♣︎, J♥︎, 7♦︎, K♦︎, J♣︎, 8♠︎, 10♠︎, 7♠︎, K♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(QUEEN, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[10♦︎, A♥︎]", jacqueline.getCards().toString()); + assertEquals("[J♠︎, 9♠︎]", chantal.getCards().toString()); + assertEquals("[7♥︎, 9♦︎, 8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[Q♠︎, Q♣︎, 10♣︎, 9♣︎, 8♣︎, J♥︎, 7♦︎, K♦︎, J♣︎, 8♠︎, 10♠︎, 7♠︎, K♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[J♠︎, 9♠︎]", chantal.getCards().toString()); + assertEquals("[10♦︎, A♥︎, 7♥︎]", jacqueline.getCards().toString()); + assertEquals("[9♦︎, 8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[Q♠︎, Q♣︎, 10♣︎, 9♣︎, 8♣︎, J♥︎, 7♦︎, K♦︎, J♣︎, 8♠︎, 10♠︎, 7♠︎, K♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(JACK, SPADES)); + assertEquals(CHOOSE_SUIT, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♠︎]", chantal.getCards().toString()); + assertEquals("[10♦︎, A♥︎, 7♥︎]", jacqueline.getCards().toString()); + assertEquals("[9♦︎, 8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[J♠︎, Q♠︎, Q♣︎, 10♣︎, 9♣︎, 8♣︎, J♥︎, 7♦︎, K♦︎, J♣︎, 8♠︎, 10♠︎, 7♠︎, K♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseSuit(SPADES); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[10♦︎, A♥︎, 7♥︎]", jacqueline.getCards().toString()); + assertEquals("[9♠︎]", chantal.getCards().toString()); + assertEquals("[9♦︎, 8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[J♠︎, Q♠︎, Q♣︎, 10♣︎, 9♣︎, 8♣︎, J♥︎, 7♦︎, K♦︎, J♣︎, 8♠︎, 10♠︎, 7♠︎, K♠︎]", game.getDiscardPile().toString()); + assertEquals(SPADES, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.mau(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[10♦︎, A♥︎, 7♥︎]", jacqueline.getCards().toString()); + assertEquals("[9♠︎]", chantal.getCards().toString()); + assertEquals("[9♦︎, 8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[J♠︎, Q♠︎, Q♣︎, 10♣︎, 9♣︎, 8♣︎, J♥︎, 7♦︎, K♦︎, J♣︎, 8♠︎, 10♠︎, 7♠︎, K♠︎]", game.getDiscardPile().toString()); + assertEquals(SPADES, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♠︎]", chantal.getCards().toString()); + assertEquals("[10♦︎, A♥︎, 7♥︎, 9♦︎]", jacqueline.getCards().toString()); + assertEquals("[8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[J♠︎, Q♠︎, Q♣︎, 10♣︎, 9♣︎, 8♣︎, J♥︎, 7♦︎, K♦︎, J♣︎, 8♠︎, 10♠︎, 7♠︎, K♠︎]", game.getDiscardPile().toString()); + assertEquals(SPADES, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(NINE, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[10♦︎, A♥︎, 7♥︎, 9♦︎]", jacqueline.getCards().toString()); + assertEquals("[]", chantal.getCards().toString()); + assertEquals("[8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[9♠︎, J♠︎, Q♠︎, Q♣︎, 10♣︎, 9♣︎, 8♣︎, J♥︎, 7♦︎, K♦︎, J♣︎, 8♠︎, 10♠︎, 7♠︎, K♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.maumau(); + assertEquals(GAME_OVER, game.getGameState()); + assertEquals(List.of(), game.getPlayers()); + assertEquals(List.of(chantal, jacqueline), game.getRanking()); + assertEquals("[8♥︎, 7♣︎, Q♦︎, A♠︎, K♥︎, Q♥︎, 8♦︎, A♣︎, 10♥︎, J♦︎, 9♥︎, K♣︎, A♦︎]", game.getDrawPile().toString()); + assertEquals("[9♠︎, J♠︎, Q♠︎, Q♣︎, 10♣︎, 9♣︎, 8♣︎, J♥︎, 7♦︎, K♦︎, J♣︎, 8♠︎, 10♠︎, 7♠︎, K♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + } +} \ No newline at end of file diff --git a/test/cards/maumau/model/MauMau5Test.java b/test/cards/maumau/model/MauMau5Test.java new file mode 100644 index 0000000..2b56c42 --- /dev/null +++ b/test/cards/maumau/model/MauMau5Test.java @@ -0,0 +1,533 @@ +package cards.maumau.model; + +import cards.Card; +import cards.Rank; +import cards.Suit; +import org.junit.Test; + +import java.util.List; + +import static cards.Rank.ACE; +import static cards.Rank.EIGHT; +import static cards.Rank.JACK; +import static cards.Rank.KING; +import static cards.Rank.NINE; +import static cards.Rank.QUEEN; +import static cards.Rank.SEVEN; +import static cards.Rank.TEN; +import static cards.Suit.CLUBS; +import static cards.Suit.DIAMONDS; +import static cards.Suit.HEARTS; +import static cards.Suit.SPADES; +import static cards.maumau.model.GameState.CHOOSE_SUIT; +import static cards.maumau.model.GameState.GAME_INITIALIZED; +import static cards.maumau.model.GameState.GAME_OVER; +import static cards.maumau.model.GameState.PLAY; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class MauMau5Test { + private static Card c(Rank r, Suit s) { + return new Card(r, s); + } + + @Test + public void game() { + final List deck = List.of(c(ACE, DIAMONDS), c(NINE, HEARTS), c(JACK, HEARTS), c(KING, SPADES), c(SEVEN, CLUBS), c(NINE, CLUBS), c(SEVEN, HEARTS), c(KING, DIAMONDS), c(TEN, HEARTS), c(ACE, CLUBS), c(JACK, SPADES), c(ACE, SPADES), c(SEVEN, DIAMONDS), c(ACE, HEARTS), c(QUEEN, SPADES), c(EIGHT, CLUBS), c(TEN, DIAMONDS), c(NINE, DIAMONDS), c(EIGHT, DIAMONDS), c(SEVEN, SPADES), c(QUEEN, HEARTS), c(JACK, CLUBS), c(KING, CLUBS), c(EIGHT, SPADES), c(JACK, DIAMONDS), c(EIGHT, HEARTS), c(QUEEN, CLUBS), c(NINE, SPADES), c(TEN, CLUBS), c(KING, HEARTS), c(TEN, SPADES), c(QUEEN, DIAMONDS)); + final MauMau game = new MauMau(5, deck); + final Player jacqueline = game.addPlayer("Jacqueline"); + final Player chantal = game.addPlayer("Chantal"); + + assertEquals(GAME_INITIALIZED, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[]", jacqueline.getCards().toString()); + assertEquals("[]", chantal.getCards().toString()); + assertEquals("[A♦︎, 9♥︎, J♥︎, K♠︎, 7♣︎, 9♣︎, 7♥︎, K♦︎, 10♥︎, A♣︎, J♠︎, A♠︎, 7♦︎, A♥︎, Q♠︎, 8♣︎, 10♦︎, 9♦︎, 8♦︎, 7♠︎, Q♥︎, J♣︎, K♣︎, 8♠︎, J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + game.startGame(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[A♦︎, J♥︎, 7♣︎, 7♥︎, 10♥︎]", jacqueline.getCards().toString()); + assertEquals("[9♥︎, K♠︎, 9♣︎, K♦︎, A♣︎]", chantal.getCards().toString()); + assertEquals("[A♠︎, 7♦︎, A♥︎, Q♠︎, 8♣︎, 10♦︎, 9♦︎, 8♦︎, 7♠︎, Q♥︎, J♣︎, K♣︎, 8♠︎, J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(JACK, HEARTS)); + assertEquals(CHOOSE_SUIT, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[A♦︎, 7♣︎, 7♥︎, 10♥︎]", jacqueline.getCards().toString()); + assertEquals("[9♥︎, K♠︎, 9♣︎, K♦︎, A♣︎]", chantal.getCards().toString()); + assertEquals("[A♠︎, 7♦︎, A♥︎, Q♠︎, 8♣︎, 10♦︎, 9♦︎, 8♦︎, 7♠︎, Q♥︎, J♣︎, K♣︎, 8♠︎, J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseSuit(HEARTS); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♥︎, K♠︎, 9♣︎, K♦︎, A♣︎]", chantal.getCards().toString()); + assertEquals("[A♦︎, 7♣︎, 7♥︎, 10♥︎]", jacqueline.getCards().toString()); + assertEquals("[A♠︎, 7♦︎, A♥︎, Q♠︎, 8♣︎, 10♦︎, 9♦︎, 8♦︎, 7♠︎, Q♥︎, J♣︎, K♣︎, 8♠︎, J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertEquals(HEARTS, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(NINE, HEARTS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[A♦︎, 7♣︎, 7♥︎, 10♥︎]", jacqueline.getCards().toString()); + assertEquals("[K♠︎, 9♣︎, K♦︎, A♣︎]", chantal.getCards().toString()); + assertEquals("[A♠︎, 7♦︎, A♥︎, Q♠︎, 8♣︎, 10♦︎, 9♦︎, 8♦︎, 7♠︎, Q♥︎, J♣︎, K♣︎, 8♠︎, J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(SEVEN, HEARTS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[K♠︎, 9♣︎, K♦︎, A♣︎]", chantal.getCards().toString()); + assertEquals("[A♦︎, 7♣︎, 10♥︎]", jacqueline.getCards().toString()); + assertEquals("[A♠︎, 7♦︎, A♥︎, Q♠︎, 8♣︎, 10♦︎, 9♦︎, 8♦︎, 7♠︎, Q♥︎, J♣︎, K♣︎, 8♠︎, J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(1, game.get7Counter()); + + chantal.no7(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[K♠︎, 9♣︎, K♦︎, A♣︎, A♠︎, 7♦︎]", chantal.getCards().toString()); + assertEquals("[A♦︎, 7♣︎, 10♥︎]", jacqueline.getCards().toString()); + assertEquals("[A♥︎, Q♠︎, 8♣︎, 10♦︎, 9♦︎, 8♦︎, 7♠︎, Q♥︎, J♣︎, K♣︎, 8♠︎, J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(SEVEN, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[A♦︎, 7♣︎, 10♥︎]", jacqueline.getCards().toString()); + assertEquals("[K♠︎, 9♣︎, K♦︎, A♣︎, A♠︎]", chantal.getCards().toString()); + assertEquals("[A♥︎, Q♠︎, 8♣︎, 10♦︎, 9♦︎, 8♦︎, 7♠︎, Q♥︎, J♣︎, K♣︎, 8♠︎, J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(1, game.get7Counter()); + + jacqueline.chooseCard(c(SEVEN, CLUBS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[K♠︎, 9♣︎, K♦︎, A♣︎, A♠︎]", chantal.getCards().toString()); + assertEquals("[A♦︎, 10♥︎]", jacqueline.getCards().toString()); + assertEquals("[A♥︎, Q♠︎, 8♣︎, 10♦︎, 9♦︎, 8♦︎, 7♠︎, Q♥︎, J♣︎, K♣︎, 8♠︎, J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(2, game.get7Counter()); + + chantal.no7(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[K♠︎, 9♣︎, K♦︎, A♣︎, A♠︎, A♥︎, Q♠︎, 8♣︎, 10♦︎]", chantal.getCards().toString()); + assertEquals("[A♦︎, 10♥︎]", jacqueline.getCards().toString()); + assertEquals("[9♦︎, 8♦︎, 7♠︎, Q♥︎, J♣︎, K♣︎, 8♠︎, J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(EIGHT, CLUBS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[K♠︎, 9♣︎, K♦︎, A♣︎, A♠︎, A♥︎, Q♠︎, 10♦︎]", chantal.getCards().toString()); + assertEquals("[A♦︎, 10♥︎]", jacqueline.getCards().toString()); + assertEquals("[9♦︎, 8♦︎, 7♠︎, Q♥︎, J♣︎, K♣︎, 8♠︎, J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(NINE, CLUBS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[A♦︎, 10♥︎]", jacqueline.getCards().toString()); + assertEquals("[K♠︎, K♦︎, A♣︎, A♠︎, A♥︎, Q♠︎, 10♦︎]", chantal.getCards().toString()); + assertEquals("[9♦︎, 8♦︎, 7♠︎, Q♥︎, J♣︎, K♣︎, 8♠︎, J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[K♠︎, K♦︎, A♣︎, A♠︎, A♥︎, Q♠︎, 10♦︎]", chantal.getCards().toString()); + assertEquals("[A♦︎, 10♥︎, 9♦︎]", jacqueline.getCards().toString()); + assertEquals("[8♦︎, 7♠︎, Q♥︎, J♣︎, K♣︎, 8♠︎, J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(ACE, CLUBS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[A♦︎, 10♥︎, 9♦︎]", jacqueline.getCards().toString()); + assertEquals("[K♠︎, K♦︎, A♠︎, A♥︎, Q♠︎, 10♦︎]", chantal.getCards().toString()); + assertEquals("[8♦︎, 7♠︎, Q♥︎, J♣︎, K♣︎, 8♠︎, J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(ACE, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[K♠︎, K♦︎, A♠︎, A♥︎, Q♠︎, 10♦︎]", chantal.getCards().toString()); + assertEquals("[10♥︎, 9♦︎]", jacqueline.getCards().toString()); + assertEquals("[8♦︎, 7♠︎, Q♥︎, J♣︎, K♣︎, 8♠︎, J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(ACE, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[10♥︎, 9♦︎]", jacqueline.getCards().toString()); + assertEquals("[K♠︎, K♦︎, A♥︎, Q♠︎, 10♦︎]", chantal.getCards().toString()); + assertEquals("[8♦︎, 7♠︎, Q♥︎, J♣︎, K♣︎, 8♠︎, J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[K♠︎, K♦︎, A♥︎, Q♠︎, 10♦︎]", chantal.getCards().toString()); + assertEquals("[10♥︎, 9♦︎, 8♦︎]", jacqueline.getCards().toString()); + assertEquals("[7♠︎, Q♥︎, J♣︎, K♣︎, 8♠︎, J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(ACE, HEARTS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[10♥︎, 9♦︎, 8♦︎]", jacqueline.getCards().toString()); + assertEquals("[K♠︎, K♦︎, Q♠︎, 10♦︎]", chantal.getCards().toString()); + assertEquals("[7♠︎, Q♥︎, J♣︎, K♣︎, 8♠︎, J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[A♥︎, A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(TEN, HEARTS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[K♠︎, K♦︎, Q♠︎, 10♦︎]", chantal.getCards().toString()); + assertEquals("[9♦︎, 8♦︎]", jacqueline.getCards().toString()); + assertEquals("[7♠︎, Q♥︎, J♣︎, K♣︎, 8♠︎, J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[10♥︎, A♥︎, A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(TEN, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♦︎, 8♦︎]", jacqueline.getCards().toString()); + assertEquals("[K♠︎, K♦︎, Q♠︎]", chantal.getCards().toString()); + assertEquals("[7♠︎, Q♥︎, J♣︎, K♣︎, 8♠︎, J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[10♦︎, 10♥︎, A♥︎, A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(EIGHT, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♦︎]", jacqueline.getCards().toString()); + assertEquals("[K♠︎, K♦︎, Q♠︎]", chantal.getCards().toString()); + assertEquals("[7♠︎, Q♥︎, J♣︎, K♣︎, 8♠︎, J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[8♦︎, 10♦︎, 10♥︎, A♥︎, A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(NINE, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[K♠︎, K♦︎, Q♠︎]", chantal.getCards().toString()); + assertEquals("[7♠︎]", jacqueline.getCards().toString()); + assertEquals("[Q♥︎, J♣︎, K♣︎, 8♠︎, J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[9♦︎, 8♦︎, 10♦︎, 10♥︎, A♥︎, A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(KING, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[7♠︎, Q♥︎]", jacqueline.getCards().toString()); + assertEquals("[K♠︎, Q♠︎]", chantal.getCards().toString()); + assertEquals("[J♣︎, K♣︎, 8♠︎, J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[K♦︎, 9♦︎, 8♦︎, 10♦︎, 10♥︎, A♥︎, A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[K♠︎, Q♠︎]", chantal.getCards().toString()); + assertEquals("[7♠︎, Q♥︎, J♣︎]", jacqueline.getCards().toString()); + assertEquals("[K♣︎, 8♠︎, J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[K♦︎, 9♦︎, 8♦︎, 10♦︎, 10♥︎, A♥︎, A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(KING, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[7♠︎, Q♥︎, J♣︎]", jacqueline.getCards().toString()); + assertEquals("[Q♠︎]", chantal.getCards().toString()); + assertEquals("[K♣︎, 8♠︎, J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[K♠︎, K♦︎, 9♦︎, 8♦︎, 10♦︎, 10♥︎, A♥︎, A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.mau(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[7♠︎, Q♥︎, J♣︎]", jacqueline.getCards().toString()); + assertEquals("[Q♠︎]", chantal.getCards().toString()); + assertEquals("[K♣︎, 8♠︎, J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[K♠︎, K♦︎, 9♦︎, 8♦︎, 10♦︎, 10♥︎, A♥︎, A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(SEVEN, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[Q♠︎]", chantal.getCards().toString()); + assertEquals("[Q♥︎, J♣︎]", jacqueline.getCards().toString()); + assertEquals("[K♣︎, 8♠︎, J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[7♠︎, K♠︎, K♦︎, 9♦︎, 8♦︎, 10♦︎, 10♥︎, A♥︎, A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(1, game.get7Counter()); + + chantal.no7(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[Q♠︎, K♣︎, 8♠︎]", chantal.getCards().toString()); + assertEquals("[Q♥︎, J♣︎]", jacqueline.getCards().toString()); + assertEquals("[J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[7♠︎, K♠︎, K♦︎, 9♦︎, 8♦︎, 10♦︎, 10♥︎, A♥︎, A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(EIGHT, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[Q♠︎, K♣︎]", chantal.getCards().toString()); + assertEquals("[Q♥︎, J♣︎]", jacqueline.getCards().toString()); + assertEquals("[J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[8♠︎, 7♠︎, K♠︎, K♦︎, 9♦︎, 8♦︎, 10♦︎, 10♥︎, A♥︎, A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(QUEEN, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[Q♥︎, J♣︎]", jacqueline.getCards().toString()); + assertEquals("[K♣︎]", chantal.getCards().toString()); + assertEquals("[J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[Q♠︎, 8♠︎, 7♠︎, K♠︎, K♦︎, 9♦︎, 8♦︎, 10♦︎, 10♥︎, A♥︎, A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.mau(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[Q♥︎, J♣︎]", jacqueline.getCards().toString()); + assertEquals("[K♣︎]", chantal.getCards().toString()); + assertEquals("[J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[Q♠︎, 8♠︎, 7♠︎, K♠︎, K♦︎, 9♦︎, 8♦︎, 10♦︎, 10♥︎, A♥︎, A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(QUEEN, HEARTS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[K♣︎]", chantal.getCards().toString()); + assertEquals("[J♣︎]", jacqueline.getCards().toString()); + assertEquals("[J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[Q♥︎, Q♠︎, 8♠︎, 7♠︎, K♠︎, K♦︎, 9♦︎, 8♦︎, 10♦︎, 10♥︎, A♥︎, A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.mau(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[K♣︎]", chantal.getCards().toString()); + assertEquals("[J♣︎]", jacqueline.getCards().toString()); + assertEquals("[J♦︎, 8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[Q♥︎, Q♠︎, 8♠︎, 7♠︎, K♠︎, K♦︎, 9♦︎, 8♦︎, 10♦︎, 10♥︎, A♥︎, A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[J♣︎]", jacqueline.getCards().toString()); + assertEquals("[K♣︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[Q♥︎, Q♠︎, 8♠︎, 7♠︎, K♠︎, K♦︎, 9♦︎, 8♦︎, 10♦︎, 10♥︎, A♥︎, A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(JACK, CLUBS)); + assertEquals(CHOOSE_SUIT, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[]", jacqueline.getCards().toString()); + assertEquals("[K♣︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[J♣︎, Q♥︎, Q♠︎, 8♠︎, 7♠︎, K♠︎, K♦︎, 9♦︎, 8♦︎, 10♦︎, 10♥︎, A♥︎, A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseSuit(CLUBS); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[K♣︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[]", jacqueline.getCards().toString()); + assertEquals("[8♥︎, Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[J♣︎, Q♥︎, Q♠︎, 8♠︎, 7♠︎, K♠︎, K♦︎, 9♦︎, 8♦︎, 10♦︎, 10♥︎, A♥︎, A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertEquals(CLUBS, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(KING, CLUBS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♥︎]", jacqueline.getCards().toString()); + assertEquals("[J♦︎]", chantal.getCards().toString()); + assertEquals("[Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[K♣︎, J♣︎, Q♥︎, Q♠︎, 8♠︎, 7♠︎, K♠︎, K♦︎, 9♦︎, 8♦︎, 10♦︎, 10♥︎, A♥︎, A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(EIGHT, HEARTS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♥︎]", jacqueline.getCards().toString()); + assertEquals("[J♦︎]", chantal.getCards().toString()); + assertEquals("[Q♣︎, 9♠︎, 10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[K♣︎, J♣︎, Q♥︎, Q♠︎, 8♠︎, 7♠︎, K♠︎, K♦︎, 9♦︎, 8♦︎, 10♦︎, 10♥︎, A♥︎, A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[J♦︎, 9♠︎]", chantal.getCards().toString()); + assertEquals("[8♥︎, Q♣︎]", jacqueline.getCards().toString()); + assertEquals("[10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[K♣︎, J♣︎, Q♥︎, Q♠︎, 8♠︎, 7♠︎, K♠︎, K♦︎, 9♦︎, 8♦︎, 10♦︎, 10♥︎, A♥︎, A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(JACK, DIAMONDS)); + assertEquals(CHOOSE_SUIT, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♠︎]", chantal.getCards().toString()); + assertEquals("[8♥︎, Q♣︎]", jacqueline.getCards().toString()); + assertEquals("[10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[J♦︎, K♣︎, J♣︎, Q♥︎, Q♠︎, 8♠︎, 7♠︎, K♠︎, K♦︎, 9♦︎, 8♦︎, 10♦︎, 10♥︎, A♥︎, A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseSuit(SPADES); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♥︎, Q♣︎]", jacqueline.getCards().toString()); + assertEquals("[9♠︎]", chantal.getCards().toString()); + assertEquals("[10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[J♦︎, K♣︎, J♣︎, Q♥︎, Q♠︎, 8♠︎, 7♠︎, K♠︎, K♦︎, 9♦︎, 8♦︎, 10♦︎, 10♥︎, A♥︎, A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertEquals(SPADES, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.mau(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♥︎, Q♣︎]", jacqueline.getCards().toString()); + assertEquals("[9♠︎]", chantal.getCards().toString()); + assertEquals("[10♣︎, K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[J♦︎, K♣︎, J♣︎, Q♥︎, Q♠︎, 8♠︎, 7♠︎, K♠︎, K♦︎, 9♦︎, 8♦︎, 10♦︎, 10♥︎, A♥︎, A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertEquals(SPADES, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♠︎]", chantal.getCards().toString()); + assertEquals("[8♥︎, Q♣︎, 10♣︎]", jacqueline.getCards().toString()); + assertEquals("[K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[J♦︎, K♣︎, J♣︎, Q♥︎, Q♠︎, 8♠︎, 7♠︎, K♠︎, K♦︎, 9♦︎, 8♦︎, 10♦︎, 10♥︎, A♥︎, A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertEquals(SPADES, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(NINE, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♥︎, Q♣︎, 10♣︎]", jacqueline.getCards().toString()); + assertEquals("[]", chantal.getCards().toString()); + assertEquals("[K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[9♠︎, J♦︎, K♣︎, J♣︎, Q♥︎, Q♠︎, 8♠︎, 7♠︎, K♠︎, K♦︎, 9♦︎, 8♦︎, 10♦︎, 10♥︎, A♥︎, A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.maumau(); + assertEquals(GAME_OVER, game.getGameState()); + assertEquals(List.of(), game.getPlayers()); + assertEquals(List.of(chantal, jacqueline), game.getRanking()); + assertEquals("[K♥︎, 10♠︎, Q♦︎]", game.getDrawPile().toString()); + assertEquals("[9♠︎, J♦︎, K♣︎, J♣︎, Q♥︎, Q♠︎, 8♠︎, 7♠︎, K♠︎, K♦︎, 9♦︎, 8♦︎, 10♦︎, 10♥︎, A♥︎, A♠︎, A♦︎, A♣︎, 9♣︎, 8♣︎, 7♣︎, 7♦︎, 7♥︎, 9♥︎, J♥︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + } +} \ No newline at end of file diff --git a/test/cards/maumau/model/MauMau6Test.java b/test/cards/maumau/model/MauMau6Test.java new file mode 100644 index 0000000..9797741 --- /dev/null +++ b/test/cards/maumau/model/MauMau6Test.java @@ -0,0 +1,578 @@ +package cards.maumau.model; + +import cards.Card; +import cards.Rank; +import cards.Suit; +import org.junit.Test; + +import java.util.List; + +import static cards.Rank.ACE; +import static cards.Rank.EIGHT; +import static cards.Rank.JACK; +import static cards.Rank.KING; +import static cards.Rank.NINE; +import static cards.Rank.QUEEN; +import static cards.Rank.SEVEN; +import static cards.Rank.TEN; +import static cards.Suit.CLUBS; +import static cards.Suit.DIAMONDS; +import static cards.Suit.HEARTS; +import static cards.Suit.SPADES; +import static cards.maumau.model.GameState.CHOOSE_SUIT; +import static cards.maumau.model.GameState.GAME_INITIALIZED; +import static cards.maumau.model.GameState.PLAY; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class MauMau6Test { + private static Card c(Rank r, Suit s) { + return new Card(r, s); + } + + @Test + public void game() { + final List deck = List.of(c(QUEEN, SPADES), c(TEN, SPADES), c(SEVEN, DIAMONDS), c(EIGHT, DIAMONDS), c(ACE, SPADES), c(QUEEN, CLUBS), c(EIGHT, SPADES), c(NINE, CLUBS), c(SEVEN, SPADES), c(ACE, CLUBS), c(EIGHT, HEARTS), c(QUEEN, HEARTS), c(JACK, DIAMONDS), c(KING, CLUBS), c(NINE, HEARTS), c(EIGHT, CLUBS), c(ACE, DIAMONDS), c(QUEEN, DIAMONDS), c(JACK, HEARTS), c(TEN, HEARTS), c(KING, HEARTS), c(KING, DIAMONDS), c(JACK, SPADES), c(KING, SPADES), c(TEN, CLUBS), c(NINE, SPADES), c(JACK, CLUBS), c(SEVEN, CLUBS), c(ACE, HEARTS), c(NINE, DIAMONDS), c(TEN, DIAMONDS), c(SEVEN, HEARTS)); + final MauMau game = new MauMau(5, deck); + final Player jacqueline = game.addPlayer("Jacqueline"); + final Player chantal = game.addPlayer("Chantal"); + + assertEquals(GAME_INITIALIZED, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[]", jacqueline.getCards().toString()); + assertEquals("[]", chantal.getCards().toString()); + assertEquals("[Q♠︎, 10♠︎, 7♦︎, 8♦︎, A♠︎, Q♣︎, 8♠︎, 9♣︎, 7♠︎, A♣︎, 8♥︎, Q♥︎, J♦︎, K♣︎, 9♥︎, 8♣︎, A♦︎, Q♦︎, J♥︎, 10♥︎, K♥︎, K♦︎, J♠︎, K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + game.startGame(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[Q♠︎, 7♦︎, A♠︎, 8♠︎, 7♠︎]", jacqueline.getCards().toString()); + assertEquals("[10♠︎, 8♦︎, Q♣︎, 9♣︎, A♣︎]", chantal.getCards().toString()); + assertEquals("[Q♥︎, J♦︎, K♣︎, 9♥︎, 8♣︎, A♦︎, Q♦︎, J♥︎, 10♥︎, K♥︎, K♦︎, J♠︎, K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(EIGHT, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[Q♠︎, 7♦︎, A♠︎, 7♠︎]", jacqueline.getCards().toString()); + assertEquals("[10♠︎, 8♦︎, Q♣︎, 9♣︎, A♣︎]", chantal.getCards().toString()); + assertEquals("[Q♥︎, J♦︎, K♣︎, 9♥︎, 8♣︎, A♦︎, Q♦︎, J♥︎, 10♥︎, K♥︎, K♦︎, J♠︎, K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(SEVEN, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[10♠︎, 8♦︎, Q♣︎, 9♣︎, A♣︎]", chantal.getCards().toString()); + assertEquals("[Q♠︎, 7♦︎, A♠︎]", jacqueline.getCards().toString()); + assertEquals("[Q♥︎, J♦︎, K♣︎, 9♥︎, 8♣︎, A♦︎, Q♦︎, J♥︎, 10♥︎, K♥︎, K♦︎, J♠︎, K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(1, game.get7Counter()); + + chantal.no7(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[10♠︎, 8♦︎, Q♣︎, 9♣︎, A♣︎, Q♥︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[Q♠︎, 7♦︎, A♠︎]", jacqueline.getCards().toString()); + assertEquals("[K♣︎, 9♥︎, 8♣︎, A♦︎, Q♦︎, J♥︎, 10♥︎, K♥︎, K♦︎, J♠︎, K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(TEN, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[Q♠︎, 7♦︎, A♠︎]", jacqueline.getCards().toString()); + assertEquals("[8♦︎, Q♣︎, 9♣︎, A♣︎, Q♥︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[K♣︎, 9♥︎, 8♣︎, A♦︎, Q♦︎, J♥︎, 10♥︎, K♥︎, K♦︎, J♠︎, K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(QUEEN, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♦︎, Q♣︎, 9♣︎, A♣︎, Q♥︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[7♦︎, A♠︎]", jacqueline.getCards().toString()); + assertEquals("[K♣︎, 9♥︎, 8♣︎, A♦︎, Q♦︎, J♥︎, 10♥︎, K♥︎, K♦︎, J♠︎, K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(QUEEN, HEARTS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[7♦︎, A♠︎]", jacqueline.getCards().toString()); + assertEquals("[8♦︎, Q♣︎, 9♣︎, A♣︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[K♣︎, 9♥︎, 8♣︎, A♦︎, Q♦︎, J♥︎, 10♥︎, K♥︎, K♦︎, J♠︎, K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♦︎, Q♣︎, 9♣︎, A♣︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[7♦︎, A♠︎, K♣︎]", jacqueline.getCards().toString()); + assertEquals("[9♥︎, 8♣︎, A♦︎, Q♦︎, J♥︎, 10♥︎, K♥︎, K♦︎, J♠︎, K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(QUEEN, CLUBS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[7♦︎, A♠︎, K♣︎]", jacqueline.getCards().toString()); + assertEquals("[8♦︎, 9♣︎, A♣︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[9♥︎, 8♣︎, A♦︎, Q♦︎, J♥︎, 10♥︎, K♥︎, K♦︎, J♠︎, K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(KING, CLUBS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♦︎, 9♣︎, A♣︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[7♦︎, A♠︎]", jacqueline.getCards().toString()); + assertEquals("[9♥︎, 8♣︎, A♦︎, Q♦︎, J♥︎, 10♥︎, K♥︎, K♦︎, J♠︎, K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(NINE, CLUBS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[7♦︎, A♠︎]", jacqueline.getCards().toString()); + assertEquals("[8♦︎, A♣︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[9♥︎, 8♣︎, A♦︎, Q♦︎, J♥︎, 10♥︎, K♥︎, K♦︎, J♠︎, K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♦︎, A♣︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[7♦︎, A♠︎, 9♥︎]", jacqueline.getCards().toString()); + assertEquals("[8♣︎, A♦︎, Q♦︎, J♥︎, 10♥︎, K♥︎, K♦︎, J♠︎, K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(ACE, CLUBS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[7♦︎, A♠︎, 9♥︎]", jacqueline.getCards().toString()); + assertEquals("[8♦︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[8♣︎, A♦︎, Q♦︎, J♥︎, 10♥︎, K♥︎, K♦︎, J♠︎, K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(ACE, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♦︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[7♦︎, 9♥︎]", jacqueline.getCards().toString()); + assertEquals("[8♣︎, A♦︎, Q♦︎, J♥︎, 10♥︎, K♥︎, K♦︎, J♠︎, K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(JACK, DIAMONDS)); + assertEquals(CHOOSE_SUIT, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♦︎]", chantal.getCards().toString()); + assertEquals("[7♦︎, 9♥︎]", jacqueline.getCards().toString()); + assertEquals("[8♣︎, A♦︎, Q♦︎, J♥︎, 10♥︎, K♥︎, K♦︎, J♠︎, K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseSuit(DIAMONDS); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[7♦︎, 9♥︎]", jacqueline.getCards().toString()); + assertEquals("[8♦︎]", chantal.getCards().toString()); + assertEquals("[8♣︎, A♦︎, Q♦︎, J♥︎, 10♥︎, K♥︎, K♦︎, J♠︎, K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertEquals(DIAMONDS, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(SEVEN, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♦︎, 8♣︎]", chantal.getCards().toString()); + assertEquals("[9♥︎]", jacqueline.getCards().toString()); + assertEquals("[A♦︎, Q♦︎, J♥︎, 10♥︎, K♥︎, K♦︎, J♠︎, K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(1, game.get7Counter()); + + chantal.no7(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♦︎, 8♣︎, A♦︎, Q♦︎]", chantal.getCards().toString()); + assertEquals("[9♥︎]", jacqueline.getCards().toString()); + assertEquals("[J♥︎, 10♥︎, K♥︎, K♦︎, J♠︎, K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(EIGHT, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♣︎, A♦︎, Q♦︎]", chantal.getCards().toString()); + assertEquals("[9♥︎, J♥︎]", jacqueline.getCards().toString()); + assertEquals("[10♥︎, K♥︎, K♦︎, J♠︎, K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(ACE, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♥︎, J♥︎]", jacqueline.getCards().toString()); + assertEquals("[8♣︎, Q♦︎]", chantal.getCards().toString()); + assertEquals("[10♥︎, K♥︎, K♦︎, J♠︎, K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[A♦︎, 8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(JACK, HEARTS)); + assertEquals(CHOOSE_SUIT, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♥︎]", jacqueline.getCards().toString()); + assertEquals("[8♣︎, Q♦︎]", chantal.getCards().toString()); + assertEquals("[10♥︎, K♥︎, K♦︎, J♠︎, K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[J♥︎, A♦︎, 8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseSuit(DIAMONDS); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♣︎, Q♦︎]", chantal.getCards().toString()); + assertEquals("[9♥︎]", jacqueline.getCards().toString()); + assertEquals("[10♥︎, K♥︎, K♦︎, J♠︎, K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[J♥︎, A♦︎, 8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertEquals(DIAMONDS, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.mau(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♣︎, Q♦︎]", chantal.getCards().toString()); + assertEquals("[9♥︎]", jacqueline.getCards().toString()); + assertEquals("[10♥︎, K♥︎, K♦︎, J♠︎, K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[J♥︎, A♦︎, 8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertEquals(DIAMONDS, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(QUEEN, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♥︎]", jacqueline.getCards().toString()); + assertEquals("[8♣︎]", chantal.getCards().toString()); + assertEquals("[10♥︎, K♥︎, K♦︎, J♠︎, K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[Q♦︎, J♥︎, A♦︎, 8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.mau(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♥︎]", jacqueline.getCards().toString()); + assertEquals("[8♣︎]", chantal.getCards().toString()); + assertEquals("[10♥︎, K♥︎, K♦︎, J♠︎, K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[Q♦︎, J♥︎, A♦︎, 8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♣︎]", chantal.getCards().toString()); + assertEquals("[9♥︎, 10♥︎]", jacqueline.getCards().toString()); + assertEquals("[K♥︎, K♦︎, J♠︎, K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[Q♦︎, J♥︎, A♦︎, 8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♥︎, 10♥︎]", jacqueline.getCards().toString()); + assertEquals("[8♣︎, K♥︎]", chantal.getCards().toString()); + assertEquals("[K♦︎, J♠︎, K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[Q♦︎, J♥︎, A♦︎, 8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♣︎, K♥︎]", chantal.getCards().toString()); + assertEquals("[9♥︎, 10♥︎, K♦︎]", jacqueline.getCards().toString()); + assertEquals("[J♠︎, K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[Q♦︎, J♥︎, A♦︎, 8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♥︎, 10♥︎, K♦︎]", jacqueline.getCards().toString()); + assertEquals("[8♣︎, K♥︎, J♠︎]", chantal.getCards().toString()); + assertEquals("[K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[Q♦︎, J♥︎, A♦︎, 8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(KING, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♣︎, K♥︎, J♠︎]", chantal.getCards().toString()); + assertEquals("[9♥︎, 10♥︎]", jacqueline.getCards().toString()); + assertEquals("[K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[K♦︎, Q♦︎, J♥︎, A♦︎, 8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(KING, HEARTS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♥︎, 10♥︎]", jacqueline.getCards().toString()); + assertEquals("[8♣︎, J♠︎]", chantal.getCards().toString()); + assertEquals("[K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[K♥︎, K♦︎, Q♦︎, J♥︎, A♦︎, 8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(TEN, HEARTS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♣︎, J♠︎]", chantal.getCards().toString()); + assertEquals("[9♥︎]", jacqueline.getCards().toString()); + assertEquals("[K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[10♥︎, K♥︎, K♦︎, Q♦︎, J♥︎, A♦︎, 8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(JACK, SPADES)); + assertEquals(CHOOSE_SUIT, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♣︎]", chantal.getCards().toString()); + assertEquals("[9♥︎]", jacqueline.getCards().toString()); + assertEquals("[K♠︎, 10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[J♠︎, 10♥︎, K♥︎, K♦︎, Q♦︎, J♥︎, A♦︎, 8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseSuit(CLUBS); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♥︎, K♠︎]", jacqueline.getCards().toString()); + assertEquals("[8♣︎]", chantal.getCards().toString()); + assertEquals("[10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[J♠︎, 10♥︎, K♥︎, K♦︎, Q♦︎, J♥︎, A♦︎, 8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertEquals(CLUBS, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.mau(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♥︎, K♠︎]", jacqueline.getCards().toString()); + assertEquals("[8♣︎]", chantal.getCards().toString()); + assertEquals("[10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[J♠︎, 10♥︎, K♥︎, K♦︎, Q♦︎, J♥︎, A♦︎, 8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertEquals(CLUBS, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(EIGHT, CLUBS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♥︎, K♠︎]", jacqueline.getCards().toString()); + assertEquals("[8♣︎]", chantal.getCards().toString()); + assertEquals("[10♣︎, 9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[J♠︎, 10♥︎, K♥︎, K♦︎, Q♦︎, J♥︎, A♦︎, 8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertEquals(CLUBS, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♣︎]", chantal.getCards().toString()); + assertEquals("[9♥︎, K♠︎, 10♣︎]", jacqueline.getCards().toString()); + assertEquals("[9♠︎, J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[J♠︎, 10♥︎, K♥︎, K♦︎, Q♦︎, J♥︎, A♦︎, 8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertEquals(CLUBS, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♥︎, K♠︎, 10♣︎]", jacqueline.getCards().toString()); + assertEquals("[8♣︎, 9♠︎]", chantal.getCards().toString()); + assertEquals("[J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[J♠︎, 10♥︎, K♥︎, K♦︎, Q♦︎, J♥︎, A♦︎, 8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertEquals(CLUBS, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(TEN, CLUBS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♣︎, 9♠︎]", chantal.getCards().toString()); + assertEquals("[9♥︎, K♠︎]", jacqueline.getCards().toString()); + assertEquals("[J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[10♣︎, J♠︎, 10♥︎, K♥︎, K♦︎, Q♦︎, J♥︎, A♦︎, 8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(EIGHT, CLUBS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♠︎]", chantal.getCards().toString()); + assertEquals("[9♥︎, K♠︎]", jacqueline.getCards().toString()); + assertEquals("[J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[8♣︎, 10♣︎, J♠︎, 10♥︎, K♥︎, K♦︎, Q♦︎, J♥︎, A♦︎, 8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(NINE, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♠︎]", chantal.getCards().toString()); + assertEquals("[9♥︎, K♠︎]", jacqueline.getCards().toString()); + assertEquals("[J♣︎, 7♣︎, A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[8♣︎, 10♣︎, J♠︎, 10♥︎, K♥︎, K♦︎, Q♦︎, J♥︎, A♦︎, 8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♥︎, K♠︎]", jacqueline.getCards().toString()); + assertEquals("[9♠︎, J♣︎, 7♣︎]", chantal.getCards().toString()); + assertEquals("[A♥︎, 9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[8♣︎, 10♣︎, J♠︎, 10♥︎, K♥︎, K♦︎, Q♦︎, J♥︎, A♦︎, 8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♠︎, J♣︎, 7♣︎]", chantal.getCards().toString()); + assertEquals("[9♥︎, K♠︎, A♥︎]", jacqueline.getCards().toString()); + assertEquals("[9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[8♣︎, 10♣︎, J♠︎, 10♥︎, K♥︎, K♦︎, Q♦︎, J♥︎, A♦︎, 8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(SEVEN, CLUBS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♥︎, K♠︎, A♥︎]", jacqueline.getCards().toString()); + assertEquals("[9♠︎, J♣︎]", chantal.getCards().toString()); + assertEquals("[9♦︎, 10♦︎, 7♥︎]", game.getDrawPile().toString()); + assertEquals("[7♣︎, 8♣︎, 10♣︎, J♠︎, 10♥︎, K♥︎, K♦︎, Q♦︎, J♥︎, A♦︎, 8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(1, game.get7Counter()); + + jacqueline.no7(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♥︎, K♠︎, A♥︎, 9♦︎, 10♦︎]", jacqueline.getCards().toString()); + assertEquals("[9♠︎, J♣︎]", chantal.getCards().toString()); + assertEquals("[7♥︎]", game.getDrawPile().toString()); + assertEquals("[7♣︎, 8♣︎, 10♣︎, J♠︎, 10♥︎, K♥︎, K♦︎, Q♦︎, J♥︎, A♦︎, 8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(JACK, CLUBS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♥︎, K♠︎, A♥︎, 9♦︎, 10♦︎]", jacqueline.getCards().toString()); + assertEquals("[9♠︎, J♣︎]", chantal.getCards().toString()); + assertEquals("[7♥︎]", game.getDrawPile().toString()); + assertEquals("[7♣︎, 8♣︎, 10♣︎, J♠︎, 10♥︎, K♥︎, K♦︎, Q♦︎, J♥︎, A♦︎, 8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseSuit(SPADES); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♥︎, K♠︎, A♥︎, 9♦︎, 10♦︎]", jacqueline.getCards().toString()); + assertEquals("[9♠︎, J♣︎]", chantal.getCards().toString()); + assertEquals("[7♥︎]", game.getDrawPile().toString()); + assertEquals("[7♣︎, 8♣︎, 10♣︎, J♠︎, 10♥︎, K♥︎, K♦︎, Q♦︎, J♥︎, A♦︎, 8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(KING, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♥︎, K♠︎, A♥︎, 9♦︎, 10♦︎]", jacqueline.getCards().toString()); + assertEquals("[9♠︎, J♣︎]", chantal.getCards().toString()); + assertEquals("[7♥︎]", game.getDrawPile().toString()); + assertEquals("[7♣︎, 8♣︎, 10♣︎, J♠︎, 10♥︎, K♥︎, K♦︎, Q♦︎, J♥︎, A♦︎, 8♦︎, 7♦︎, J♦︎, A♠︎, A♣︎, 9♣︎, K♣︎, Q♣︎, Q♥︎, Q♠︎, 10♠︎, 7♠︎, 8♠︎, 8♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + } +} \ No newline at end of file diff --git a/test/cards/maumau/model/MauMau7Test.java b/test/cards/maumau/model/MauMau7Test.java new file mode 100644 index 0000000..ccd90d5 --- /dev/null +++ b/test/cards/maumau/model/MauMau7Test.java @@ -0,0 +1,302 @@ +package cards.maumau.model; + +import cards.Card; +import cards.Rank; +import cards.Suit; +import org.junit.Test; + +import java.util.List; + +import static cards.Rank.ACE; +import static cards.Rank.EIGHT; +import static cards.Rank.JACK; +import static cards.Rank.KING; +import static cards.Rank.NINE; +import static cards.Rank.QUEEN; +import static cards.Rank.SEVEN; +import static cards.Rank.TEN; +import static cards.Suit.CLUBS; +import static cards.Suit.DIAMONDS; +import static cards.Suit.HEARTS; +import static cards.Suit.SPADES; +import static cards.maumau.model.GameState.CHOOSE_SUIT; +import static cards.maumau.model.GameState.GAME_INITIALIZED; +import static cards.maumau.model.GameState.GAME_OVER; +import static cards.maumau.model.GameState.PLAY; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class MauMau7Test { + private static Card c(Rank r, Suit s) { + return new Card(r, s); + } + + @Test + public void game() { + final List deck = List.of(c(EIGHT, DIAMONDS), c(JACK, DIAMONDS), c(ACE, DIAMONDS), c(NINE, CLUBS), c(TEN, HEARTS), c(TEN, DIAMONDS), c(NINE, SPADES), c(SEVEN, HEARTS), c(QUEEN, CLUBS), c(ACE, SPADES), c(JACK, SPADES), c(JACK, CLUBS), c(SEVEN, DIAMONDS), c(JACK, HEARTS), c(TEN, SPADES), c(QUEEN, DIAMONDS), c(EIGHT, SPADES), c(QUEEN, SPADES), c(NINE, DIAMONDS), c(QUEEN, HEARTS), c(KING, CLUBS), c(KING, HEARTS), c(NINE, HEARTS), c(KING, DIAMONDS), c(EIGHT, HEARTS), c(EIGHT, CLUBS), c(TEN, CLUBS), c(SEVEN, CLUBS), c(SEVEN, SPADES), c(ACE, HEARTS), c(KING, SPADES), c(ACE, CLUBS)); + final MauMau game = new MauMau(5, deck); + final Player jacqueline = game.addPlayer("Jacqueline"); + final Player chantal = game.addPlayer("Chantal"); + + assertEquals(GAME_INITIALIZED, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[]", jacqueline.getCards().toString()); + assertEquals("[]", chantal.getCards().toString()); + assertEquals("[8♦︎, J♦︎, A♦︎, 9♣︎, 10♥︎, 10♦︎, 9♠︎, 7♥︎, Q♣︎, A♠︎, J♠︎, J♣︎, 7♦︎, J♥︎, 10♠︎, Q♦︎, 8♠︎, Q♠︎, 9♦︎, Q♥︎, K♣︎, K♥︎, 9♥︎, K♦︎, 8♥︎, 8♣︎, 10♣︎, 7♣︎, 7♠︎, A♥︎, K♠︎, A♣︎]", game.getDrawPile().toString()); + assertEquals("[]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + game.startGame(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♦︎, A♦︎, 10♥︎, 9♠︎, Q♣︎]", jacqueline.getCards().toString()); + assertEquals("[J♦︎, 9♣︎, 10♦︎, 7♥︎, A♠︎]", chantal.getCards().toString()); + assertEquals("[J♣︎, 7♦︎, J♥︎, 10♠︎, Q♦︎, 8♠︎, Q♠︎, 9♦︎, Q♥︎, K♣︎, K♥︎, 9♥︎, K♦︎, 8♥︎, 8♣︎, 10♣︎, 7♣︎, 7♠︎, A♥︎, K♠︎, A♣︎]", game.getDrawPile().toString()); + assertEquals("[J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(NINE, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[J♦︎, 9♣︎, 10♦︎, 7♥︎, A♠︎]", chantal.getCards().toString()); + assertEquals("[8♦︎, A♦︎, 10♥︎, Q♣︎]", jacqueline.getCards().toString()); + assertEquals("[J♣︎, 7♦︎, J♥︎, 10♠︎, Q♦︎, 8♠︎, Q♠︎, 9♦︎, Q♥︎, K♣︎, K♥︎, 9♥︎, K♦︎, 8♥︎, 8♣︎, 10♣︎, 7♣︎, 7♠︎, A♥︎, K♠︎, A♣︎]", game.getDrawPile().toString()); + assertEquals("[9♠︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(ACE, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♦︎, A♦︎, 10♥︎, Q♣︎]", jacqueline.getCards().toString()); + assertEquals("[J♦︎, 9♣︎, 10♦︎, 7♥︎]", chantal.getCards().toString()); + assertEquals("[J♣︎, 7♦︎, J♥︎, 10♠︎, Q♦︎, 8♠︎, Q♠︎, 9♦︎, Q♥︎, K♣︎, K♥︎, 9♥︎, K♦︎, 8♥︎, 8♣︎, 10♣︎, 7♣︎, 7♠︎, A♥︎, K♠︎, A♣︎]", game.getDrawPile().toString()); + assertEquals("[A♠︎, 9♠︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(ACE, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[J♦︎, 9♣︎, 10♦︎, 7♥︎]", chantal.getCards().toString()); + assertEquals("[8♦︎, 10♥︎, Q♣︎]", jacqueline.getCards().toString()); + assertEquals("[J♣︎, 7♦︎, J♥︎, 10♠︎, Q♦︎, 8♠︎, Q♠︎, 9♦︎, Q♥︎, K♣︎, K♥︎, 9♥︎, K♦︎, 8♥︎, 8♣︎, 10♣︎, 7♣︎, 7♠︎, A♥︎, K♠︎, A♣︎]", game.getDrawPile().toString()); + assertEquals("[A♦︎, A♠︎, 9♠︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(TEN, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♦︎, 10♥︎, Q♣︎]", jacqueline.getCards().toString()); + assertEquals("[J♦︎, 9♣︎, 7♥︎]", chantal.getCards().toString()); + assertEquals("[J♣︎, 7♦︎, J♥︎, 10♠︎, Q♦︎, 8♠︎, Q♠︎, 9♦︎, Q♥︎, K♣︎, K♥︎, 9♥︎, K♦︎, 8♥︎, 8♣︎, 10♣︎, 7♣︎, 7♠︎, A♥︎, K♠︎, A♣︎]", game.getDrawPile().toString()); + assertEquals("[10♦︎, A♦︎, A♠︎, 9♠︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(TEN, HEARTS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[J♦︎, 9♣︎, 7♥︎]", chantal.getCards().toString()); + assertEquals("[8♦︎, Q♣︎]", jacqueline.getCards().toString()); + assertEquals("[J♣︎, 7♦︎, J♥︎, 10♠︎, Q♦︎, 8♠︎, Q♠︎, 9♦︎, Q♥︎, K♣︎, K♥︎, 9♥︎, K♦︎, 8♥︎, 8♣︎, 10♣︎, 7♣︎, 7♠︎, A♥︎, K♠︎, A♣︎]", game.getDrawPile().toString()); + assertEquals("[10♥︎, 10♦︎, A♦︎, A♠︎, 9♠︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(SEVEN, HEARTS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♦︎, Q♣︎]", jacqueline.getCards().toString()); + assertEquals("[J♦︎, 9♣︎]", chantal.getCards().toString()); + assertEquals("[J♣︎, 7♦︎, J♥︎, 10♠︎, Q♦︎, 8♠︎, Q♠︎, 9♦︎, Q♥︎, K♣︎, K♥︎, 9♥︎, K♦︎, 8♥︎, 8♣︎, 10♣︎, 7♣︎, 7♠︎, A♥︎, K♠︎, A♣︎]", game.getDrawPile().toString()); + assertEquals("[7♥︎, 10♥︎, 10♦︎, A♦︎, A♠︎, 9♠︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(1, game.get7Counter()); + + jacqueline.no7(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♦︎, Q♣︎, J♣︎, 7♦︎]", jacqueline.getCards().toString()); + assertEquals("[J♦︎, 9♣︎]", chantal.getCards().toString()); + assertEquals("[J♥︎, 10♠︎, Q♦︎, 8♠︎, Q♠︎, 9♦︎, Q♥︎, K♣︎, K♥︎, 9♥︎, K♦︎, 8♥︎, 8♣︎, 10♣︎, 7♣︎, 7♠︎, A♥︎, K♠︎, A♣︎]", game.getDrawPile().toString()); + assertEquals("[7♥︎, 10♥︎, 10♦︎, A♦︎, A♠︎, 9♠︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(SEVEN, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[J♦︎, 9♣︎]", chantal.getCards().toString()); + assertEquals("[8♦︎, Q♣︎, J♣︎]", jacqueline.getCards().toString()); + assertEquals("[J♥︎, 10♠︎, Q♦︎, 8♠︎, Q♠︎, 9♦︎, Q♥︎, K♣︎, K♥︎, 9♥︎, K♦︎, 8♥︎, 8♣︎, 10♣︎, 7♣︎, 7♠︎, A♥︎, K♠︎, A♣︎]", game.getDrawPile().toString()); + assertEquals("[7♦︎, 7♥︎, 10♥︎, 10♦︎, A♦︎, A♠︎, 9♠︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(1, game.get7Counter()); + + chantal.no7(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[J♦︎, 9♣︎, J♥︎, 10♠︎]", chantal.getCards().toString()); + assertEquals("[8♦︎, Q♣︎, J♣︎]", jacqueline.getCards().toString()); + assertEquals("[Q♦︎, 8♠︎, Q♠︎, 9♦︎, Q♥︎, K♣︎, K♥︎, 9♥︎, K♦︎, 8♥︎, 8♣︎, 10♣︎, 7♣︎, 7♠︎, A♥︎, K♠︎, A♣︎]", game.getDrawPile().toString()); + assertEquals("[7♦︎, 7♥︎, 10♥︎, 10♦︎, A♦︎, A♠︎, 9♠︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(JACK, DIAMONDS)); + assertEquals(CHOOSE_SUIT, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♣︎, J♥︎, 10♠︎]", chantal.getCards().toString()); + assertEquals("[8♦︎, Q♣︎, J♣︎]", jacqueline.getCards().toString()); + assertEquals("[Q♦︎, 8♠︎, Q♠︎, 9♦︎, Q♥︎, K♣︎, K♥︎, 9♥︎, K♦︎, 8♥︎, 8♣︎, 10♣︎, 7♣︎, 7♠︎, A♥︎, K♠︎, A♣︎]", game.getDrawPile().toString()); + assertEquals("[J♦︎, 7♦︎, 7♥︎, 10♥︎, 10♦︎, A♦︎, A♠︎, 9♠︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseSuit(CLUBS); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♦︎, Q♣︎, J♣︎]", jacqueline.getCards().toString()); + assertEquals("[9♣︎, J♥︎, 10♠︎]", chantal.getCards().toString()); + assertEquals("[Q♦︎, 8♠︎, Q♠︎, 9♦︎, Q♥︎, K♣︎, K♥︎, 9♥︎, K♦︎, 8♥︎, 8♣︎, 10♣︎, 7♣︎, 7♠︎, A♥︎, K♠︎, A♣︎]", game.getDrawPile().toString()); + assertEquals("[J♦︎, 7♦︎, 7♥︎, 10♥︎, 10♦︎, A♦︎, A♠︎, 9♠︎, J♠︎]", game.getDiscardPile().toString()); + assertEquals(CLUBS, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(QUEEN, CLUBS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♣︎, J♥︎, 10♠︎]", chantal.getCards().toString()); + assertEquals("[8♦︎, J♣︎]", jacqueline.getCards().toString()); + assertEquals("[Q♦︎, 8♠︎, Q♠︎, 9♦︎, Q♥︎, K♣︎, K♥︎, 9♥︎, K♦︎, 8♥︎, 8♣︎, 10♣︎, 7♣︎, 7♠︎, A♥︎, K♠︎, A♣︎]", game.getDrawPile().toString()); + assertEquals("[Q♣︎, J♦︎, 7♦︎, 7♥︎, 10♥︎, 10♦︎, A♦︎, A♠︎, 9♠︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(NINE, CLUBS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♦︎, J♣︎]", jacqueline.getCards().toString()); + assertEquals("[J♥︎, 10♠︎]", chantal.getCards().toString()); + assertEquals("[Q♦︎, 8♠︎, Q♠︎, 9♦︎, Q♥︎, K♣︎, K♥︎, 9♥︎, K♦︎, 8♥︎, 8♣︎, 10♣︎, 7♣︎, 7♠︎, A♥︎, K♠︎, A♣︎]", game.getDrawPile().toString()); + assertEquals("[9♣︎, Q♣︎, J♦︎, 7♦︎, 7♥︎, 10♥︎, 10♦︎, A♦︎, A♠︎, 9♠︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[J♥︎, 10♠︎]", chantal.getCards().toString()); + assertEquals("[8♦︎, J♣︎, Q♦︎]", jacqueline.getCards().toString()); + assertEquals("[8♠︎, Q♠︎, 9♦︎, Q♥︎, K♣︎, K♥︎, 9♥︎, K♦︎, 8♥︎, 8♣︎, 10♣︎, 7♣︎, 7♠︎, A♥︎, K♠︎, A♣︎]", game.getDrawPile().toString()); + assertEquals("[9♣︎, Q♣︎, J♦︎, 7♦︎, 7♥︎, 10♥︎, 10♦︎, A♦︎, A♠︎, 9♠︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♦︎, J♣︎, Q♦︎]", jacqueline.getCards().toString()); + assertEquals("[J♥︎, 10♠︎, 8♠︎]", chantal.getCards().toString()); + assertEquals("[Q♠︎, 9♦︎, Q♥︎, K♣︎, K♥︎, 9♥︎, K♦︎, 8♥︎, 8♣︎, 10♣︎, 7♣︎, 7♠︎, A♥︎, K♠︎, A♣︎]", game.getDrawPile().toString()); + assertEquals("[9♣︎, Q♣︎, J♦︎, 7♦︎, 7♥︎, 10♥︎, 10♦︎, A♦︎, A♠︎, 9♠︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(JACK, CLUBS)); + assertEquals(CHOOSE_SUIT, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♦︎, Q♦︎]", jacqueline.getCards().toString()); + assertEquals("[J♥︎, 10♠︎, 8♠︎]", chantal.getCards().toString()); + assertEquals("[Q♠︎, 9♦︎, Q♥︎, K♣︎, K♥︎, 9♥︎, K♦︎, 8♥︎, 8♣︎, 10♣︎, 7♣︎, 7♠︎, A♥︎, K♠︎, A♣︎]", game.getDrawPile().toString()); + assertEquals("[J♣︎, 9♣︎, Q♣︎, J♦︎, 7♦︎, 7♥︎, 10♥︎, 10♦︎, A♦︎, A♠︎, 9♠︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseSuit(DIAMONDS); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[J♥︎, 10♠︎, 8♠︎]", chantal.getCards().toString()); + assertEquals("[8♦︎, Q♦︎]", jacqueline.getCards().toString()); + assertEquals("[Q♠︎, 9♦︎, Q♥︎, K♣︎, K♥︎, 9♥︎, K♦︎, 8♥︎, 8♣︎, 10♣︎, 7♣︎, 7♠︎, A♥︎, K♠︎, A♣︎]", game.getDrawPile().toString()); + assertEquals("[J♣︎, 9♣︎, Q♣︎, J♦︎, 7♦︎, 7♥︎, 10♥︎, 10♦︎, A♦︎, A♠︎, 9♠︎, J♠︎]", game.getDiscardPile().toString()); + assertEquals(DIAMONDS, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♦︎, Q♦︎]", jacqueline.getCards().toString()); + assertEquals("[J♥︎, 10♠︎, 8♠︎, Q♠︎]", chantal.getCards().toString()); + assertEquals("[9♦︎, Q♥︎, K♣︎, K♥︎, 9♥︎, K♦︎, 8♥︎, 8♣︎, 10♣︎, 7♣︎, 7♠︎, A♥︎, K♠︎, A♣︎]", game.getDrawPile().toString()); + assertEquals("[J♣︎, 9♣︎, Q♣︎, J♦︎, 7♦︎, 7♥︎, 10♥︎, 10♦︎, A♦︎, A♠︎, 9♠︎, J♠︎]", game.getDiscardPile().toString()); + assertEquals(DIAMONDS, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(EIGHT, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[Q♦︎]", jacqueline.getCards().toString()); + assertEquals("[J♥︎, 10♠︎, 8♠︎, Q♠︎]", chantal.getCards().toString()); + assertEquals("[9♦︎, Q♥︎, K♣︎, K♥︎, 9♥︎, K♦︎, 8♥︎, 8♣︎, 10♣︎, 7♣︎, 7♠︎, A♥︎, K♠︎, A♣︎]", game.getDrawPile().toString()); + assertEquals("[8♦︎, J♣︎, 9♣︎, Q♣︎, J♦︎, 7♦︎, 7♥︎, 10♥︎, 10♦︎, A♦︎, A♠︎, 9♠︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.mau(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[Q♦︎]", jacqueline.getCards().toString()); + assertEquals("[J♥︎, 10♠︎, 8♠︎, Q♠︎]", chantal.getCards().toString()); + assertEquals("[9♦︎, Q♥︎, K♣︎, K♥︎, 9♥︎, K♦︎, 8♥︎, 8♣︎, 10♣︎, 7♣︎, 7♠︎, A♥︎, K♠︎, A♣︎]", game.getDrawPile().toString()); + assertEquals("[8♦︎, J♣︎, 9♣︎, Q♣︎, J♦︎, 7♦︎, 7♥︎, 10♥︎, 10♦︎, A♦︎, A♠︎, 9♠︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(QUEEN, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[J♥︎, 10♠︎, 8♠︎, Q♠︎]", chantal.getCards().toString()); + assertEquals("[]", jacqueline.getCards().toString()); + assertEquals("[9♦︎, Q♥︎, K♣︎, K♥︎, 9♥︎, K♦︎, 8♥︎, 8♣︎, 10♣︎, 7♣︎, 7♠︎, A♥︎, K♠︎, A♣︎]", game.getDrawPile().toString()); + assertEquals("[Q♦︎, 8♦︎, J♣︎, 9♣︎, Q♣︎, J♦︎, 7♦︎, 7♥︎, 10♥︎, 10♦︎, A♦︎, A♠︎, 9♠︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.maumau(); + assertEquals(GAME_OVER, game.getGameState()); + assertEquals(List.of(), game.getPlayers()); + assertEquals(List.of(jacqueline, chantal), game.getRanking()); + assertEquals("[9♦︎, Q♥︎, K♣︎, K♥︎, 9♥︎, K♦︎, 8♥︎, 8♣︎, 10♣︎, 7♣︎, 7♠︎, A♥︎, K♠︎, A♣︎]", game.getDrawPile().toString()); + assertEquals("[Q♦︎, 8♦︎, J♣︎, 9♣︎, Q♣︎, J♦︎, 7♦︎, 7♥︎, 10♥︎, 10♦︎, A♦︎, A♠︎, 9♠︎, J♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + } +} \ No newline at end of file diff --git a/test/cards/maumau/model/MauMau8Test.java b/test/cards/maumau/model/MauMau8Test.java new file mode 100644 index 0000000..533d385 --- /dev/null +++ b/test/cards/maumau/model/MauMau8Test.java @@ -0,0 +1,463 @@ +package cards.maumau.model; + +import cards.Card; +import cards.Rank; +import cards.Suit; +import org.junit.Test; + +import java.util.List; + +import static cards.Rank.ACE; +import static cards.Rank.EIGHT; +import static cards.Rank.JACK; +import static cards.Rank.KING; +import static cards.Rank.NINE; +import static cards.Rank.QUEEN; +import static cards.Rank.SEVEN; +import static cards.Rank.TEN; +import static cards.Suit.CLUBS; +import static cards.Suit.DIAMONDS; +import static cards.Suit.HEARTS; +import static cards.Suit.SPADES; +import static cards.maumau.model.GameState.CHOOSE_SUIT; +import static cards.maumau.model.GameState.GAME_INITIALIZED; +import static cards.maumau.model.GameState.GAME_OVER; +import static cards.maumau.model.GameState.PLAY; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class MauMau8Test { + private static Card c(Rank r, Suit s) { + return new Card(r, s); + } + + @Test + public void game() { + final List deck = List.of(c(NINE, DIAMONDS), c(QUEEN, SPADES), c(EIGHT, SPADES), c(TEN, CLUBS), c(ACE, DIAMONDS), c(JACK, CLUBS), c(NINE, SPADES), c(QUEEN, DIAMONDS), c(EIGHT, HEARTS), c(TEN, SPADES), c(TEN, DIAMONDS), c(SEVEN, HEARTS), c(KING, HEARTS), c(SEVEN, CLUBS), c(NINE, HEARTS), c(SEVEN, SPADES), c(NINE, CLUBS), c(ACE, HEARTS), c(JACK, DIAMONDS), c(KING, DIAMONDS), c(EIGHT, DIAMONDS), c(JACK, SPADES), c(QUEEN, CLUBS), c(SEVEN, DIAMONDS), c(EIGHT, CLUBS), c(ACE, CLUBS), c(QUEEN, HEARTS), c(KING, CLUBS), c(TEN, HEARTS), c(ACE, SPADES), c(KING, SPADES), c(JACK, HEARTS)); + final MauMau game = new MauMau(4, deck); + final Player jacqueline = game.addPlayer("Jacqueline"); + final Player chantal = game.addPlayer("Chantal"); + final Player cheyenne = game.addPlayer("Cheyenne"); + + assertEquals(GAME_INITIALIZED, game.getGameState()); + assertEquals(List.of(jacqueline, chantal, cheyenne), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[]", jacqueline.getCards().toString()); + assertEquals("[]", chantal.getCards().toString()); + assertEquals("[]", cheyenne.getCards().toString()); + assertEquals("[9♦︎, Q♠︎, 8♠︎, 10♣︎, A♦︎, J♣︎, 9♠︎, Q♦︎, 8♥︎, 10♠︎, 10♦︎, 7♥︎, K♥︎, 7♣︎, 9♥︎, 7♠︎, 9♣︎, A♥︎, J♦︎, K♦︎, 8♦︎, J♠︎, Q♣︎, 7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + game.startGame(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal, cheyenne), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♦︎, 10♣︎, 9♠︎, 10♠︎]", jacqueline.getCards().toString()); + assertEquals("[Q♠︎, A♦︎, Q♦︎, 10♦︎]", chantal.getCards().toString()); + assertEquals("[8♠︎, J♣︎, 8♥︎, 7♥︎]", cheyenne.getCards().toString()); + assertEquals("[7♣︎, 9♥︎, 7♠︎, 9♣︎, A♥︎, J♦︎, K♦︎, 8♦︎, J♠︎, Q♣︎, 7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, cheyenne, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[Q♠︎, A♦︎, Q♦︎, 10♦︎]", chantal.getCards().toString()); + assertEquals("[8♠︎, J♣︎, 8♥︎, 7♥︎]", cheyenne.getCards().toString()); + assertEquals("[9♦︎, 10♣︎, 9♠︎, 10♠︎, 7♣︎]", jacqueline.getCards().toString()); + assertEquals("[9♥︎, 7♠︎, 9♣︎, A♥︎, J♦︎, K♦︎, 8♦︎, J♠︎, Q♣︎, 7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(cheyenne, jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♠︎, J♣︎, 8♥︎, 7♥︎]", cheyenne.getCards().toString()); + assertEquals("[9♦︎, 10♣︎, 9♠︎, 10♠︎, 7♣︎]", jacqueline.getCards().toString()); + assertEquals("[Q♠︎, A♦︎, Q♦︎, 10♦︎, 9♥︎]", chantal.getCards().toString()); + assertEquals("[7♠︎, 9♣︎, A♥︎, J♦︎, K♦︎, 8♦︎, J♠︎, Q♣︎, 7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + cheyenne.chooseCard(c(SEVEN, HEARTS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal, cheyenne), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♦︎, 10♣︎, 9♠︎, 10♠︎, 7♣︎]", jacqueline.getCards().toString()); + assertEquals("[Q♠︎, A♦︎, Q♦︎, 10♦︎, 9♥︎]", chantal.getCards().toString()); + assertEquals("[8♠︎, J♣︎, 8♥︎]", cheyenne.getCards().toString()); + assertEquals("[7♠︎, 9♣︎, A♥︎, J♦︎, K♦︎, 8♦︎, J♠︎, Q♣︎, 7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(1, game.get7Counter()); + + jacqueline.chooseCard(c(SEVEN, CLUBS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, cheyenne, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[Q♠︎, A♦︎, Q♦︎, 10♦︎, 9♥︎]", chantal.getCards().toString()); + assertEquals("[8♠︎, J♣︎, 8♥︎]", cheyenne.getCards().toString()); + assertEquals("[9♦︎, 10♣︎, 9♠︎, 10♠︎]", jacqueline.getCards().toString()); + assertEquals("[7♠︎, 9♣︎, A♥︎, J♦︎, K♦︎, 8♦︎, J♠︎, Q♣︎, 7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(2, game.get7Counter()); + + chantal.no7(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, cheyenne, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[Q♠︎, A♦︎, Q♦︎, 10♦︎, 9♥︎, 7♠︎, 9♣︎, A♥︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[8♠︎, J♣︎, 8♥︎]", cheyenne.getCards().toString()); + assertEquals("[9♦︎, 10♣︎, 9♠︎, 10♠︎]", jacqueline.getCards().toString()); + assertEquals("[K♦︎, 8♦︎, J♠︎, Q♣︎, 7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(SEVEN, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(cheyenne, jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♠︎, J♣︎, 8♥︎]", cheyenne.getCards().toString()); + assertEquals("[9♦︎, 10♣︎, 9♠︎, 10♠︎]", jacqueline.getCards().toString()); + assertEquals("[Q♠︎, A♦︎, Q♦︎, 10♦︎, 9♥︎, 9♣︎, A♥︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[K♦︎, 8♦︎, J♠︎, Q♣︎, 7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[7♠︎, 7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(1, game.get7Counter()); + + cheyenne.no7(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(cheyenne, jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♠︎, J♣︎, 8♥︎, K♦︎, 8♦︎]", cheyenne.getCards().toString()); + assertEquals("[9♦︎, 10♣︎, 9♠︎, 10♠︎]", jacqueline.getCards().toString()); + assertEquals("[Q♠︎, A♦︎, Q♦︎, 10♦︎, 9♥︎, 9♣︎, A♥︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[J♠︎, Q♣︎, 7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[7♠︎, 7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + cheyenne.chooseCard(c(EIGHT, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, cheyenne, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[Q♠︎, A♦︎, Q♦︎, 10♦︎, 9♥︎, 9♣︎, A♥︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[J♣︎, 8♥︎, K♦︎, 8♦︎]", cheyenne.getCards().toString()); + assertEquals("[9♦︎, 10♣︎, 9♠︎, 10♠︎]", jacqueline.getCards().toString()); + assertEquals("[J♠︎, Q♣︎, 7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[8♠︎, 7♠︎, 7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(QUEEN, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(cheyenne, jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[J♣︎, 8♥︎, K♦︎, 8♦︎]", cheyenne.getCards().toString()); + assertEquals("[9♦︎, 10♣︎, 9♠︎, 10♠︎]", jacqueline.getCards().toString()); + assertEquals("[A♦︎, Q♦︎, 10♦︎, 9♥︎, 9♣︎, A♥︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[J♠︎, Q♣︎, 7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[Q♠︎, 8♠︎, 7♠︎, 7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + cheyenne.chooseCard(c(JACK, CLUBS)); + assertEquals(CHOOSE_SUIT, game.getGameState()); + assertEquals(List.of(cheyenne, jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♥︎, K♦︎, 8♦︎]", cheyenne.getCards().toString()); + assertEquals("[9♦︎, 10♣︎, 9♠︎, 10♠︎]", jacqueline.getCards().toString()); + assertEquals("[A♦︎, Q♦︎, 10♦︎, 9♥︎, 9♣︎, A♥︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[J♠︎, Q♣︎, 7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[J♣︎, Q♠︎, 8♠︎, 7♠︎, 7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + cheyenne.chooseSuit(HEARTS); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal, cheyenne), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♦︎, 10♣︎, 9♠︎, 10♠︎]", jacqueline.getCards().toString()); + assertEquals("[A♦︎, Q♦︎, 10♦︎, 9♥︎, 9♣︎, A♥︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[8♥︎, K♦︎, 8♦︎]", cheyenne.getCards().toString()); + assertEquals("[J♠︎, Q♣︎, 7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[J♣︎, Q♠︎, 8♠︎, 7♠︎, 7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertEquals(HEARTS, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, cheyenne, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[A♦︎, Q♦︎, 10♦︎, 9♥︎, 9♣︎, A♥︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[8♥︎, K♦︎, 8♦︎]", cheyenne.getCards().toString()); + assertEquals("[9♦︎, 10♣︎, 9♠︎, 10♠︎, J♠︎]", jacqueline.getCards().toString()); + assertEquals("[Q♣︎, 7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[J♣︎, Q♠︎, 8♠︎, 7♠︎, 7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertEquals(HEARTS, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(NINE, HEARTS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(cheyenne, jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♥︎, K♦︎, 8♦︎]", cheyenne.getCards().toString()); + assertEquals("[9♦︎, 10♣︎, 9♠︎, 10♠︎, J♠︎]", jacqueline.getCards().toString()); + assertEquals("[A♦︎, Q♦︎, 10♦︎, 9♣︎, A♥︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[Q♣︎, 7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[9♥︎, J♣︎, Q♠︎, 8♠︎, 7♠︎, 7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + cheyenne.chooseCard(c(EIGHT, HEARTS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, cheyenne, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[A♦︎, Q♦︎, 10♦︎, 9♣︎, A♥︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[K♦︎, 8♦︎]", cheyenne.getCards().toString()); + assertEquals("[9♦︎, 10♣︎, 9♠︎, 10♠︎, J♠︎]", jacqueline.getCards().toString()); + assertEquals("[Q♣︎, 7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[8♥︎, 9♥︎, J♣︎, Q♠︎, 8♠︎, 7♠︎, 7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(ACE, HEARTS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(cheyenne, jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[K♦︎, 8♦︎]", cheyenne.getCards().toString()); + assertEquals("[9♦︎, 10♣︎, 9♠︎, 10♠︎, J♠︎]", jacqueline.getCards().toString()); + assertEquals("[A♦︎, Q♦︎, 10♦︎, 9♣︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[Q♣︎, 7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[A♥︎, 8♥︎, 9♥︎, J♣︎, Q♠︎, 8♠︎, 7♠︎, 7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + cheyenne.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal, cheyenne), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♦︎, 10♣︎, 9♠︎, 10♠︎, J♠︎]", jacqueline.getCards().toString()); + assertEquals("[A♦︎, Q♦︎, 10♦︎, 9♣︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[K♦︎, 8♦︎, Q♣︎]", cheyenne.getCards().toString()); + assertEquals("[7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[A♥︎, 8♥︎, 9♥︎, J♣︎, Q♠︎, 8♠︎, 7♠︎, 7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(JACK, SPADES)); + assertEquals(CHOOSE_SUIT, game.getGameState()); + assertEquals(List.of(jacqueline, chantal, cheyenne), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♦︎, 10♣︎, 9♠︎, 10♠︎]", jacqueline.getCards().toString()); + assertEquals("[A♦︎, Q♦︎, 10♦︎, 9♣︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[K♦︎, 8♦︎, Q♣︎]", cheyenne.getCards().toString()); + assertEquals("[7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[J♠︎, A♥︎, 8♥︎, 9♥︎, J♣︎, Q♠︎, 8♠︎, 7♠︎, 7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseSuit(CLUBS); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, cheyenne, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[A♦︎, Q♦︎, 10♦︎, 9♣︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[K♦︎, 8♦︎, Q♣︎]", cheyenne.getCards().toString()); + assertEquals("[9♦︎, 10♣︎, 9♠︎, 10♠︎]", jacqueline.getCards().toString()); + assertEquals("[7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[J♠︎, A♥︎, 8♥︎, 9♥︎, J♣︎, Q♠︎, 8♠︎, 7♠︎, 7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertEquals(CLUBS, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(NINE, CLUBS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(cheyenne, jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[K♦︎, 8♦︎, Q♣︎]", cheyenne.getCards().toString()); + assertEquals("[9♦︎, 10♣︎, 9♠︎, 10♠︎]", jacqueline.getCards().toString()); + assertEquals("[A♦︎, Q♦︎, 10♦︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[9♣︎, J♠︎, A♥︎, 8♥︎, 9♥︎, J♣︎, Q♠︎, 8♠︎, 7♠︎, 7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + cheyenne.chooseCard(c(QUEEN, CLUBS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal, cheyenne), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♦︎, 10♣︎, 9♠︎, 10♠︎]", jacqueline.getCards().toString()); + assertEquals("[A♦︎, Q♦︎, 10♦︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[K♦︎, 8♦︎]", cheyenne.getCards().toString()); + assertEquals("[7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[Q♣︎, 9♣︎, J♠︎, A♥︎, 8♥︎, 9♥︎, J♣︎, Q♠︎, 8♠︎, 7♠︎, 7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(TEN, CLUBS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, cheyenne, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[A♦︎, Q♦︎, 10♦︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[K♦︎, 8♦︎]", cheyenne.getCards().toString()); + assertEquals("[9♦︎, 9♠︎, 10♠︎]", jacqueline.getCards().toString()); + assertEquals("[7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[10♣︎, Q♣︎, 9♣︎, J♠︎, A♥︎, 8♥︎, 9♥︎, J♣︎, Q♠︎, 8♠︎, 7♠︎, 7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(TEN, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(cheyenne, jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[K♦︎, 8♦︎]", cheyenne.getCards().toString()); + assertEquals("[9♦︎, 9♠︎, 10♠︎]", jacqueline.getCards().toString()); + assertEquals("[A♦︎, Q♦︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[10♦︎, 10♣︎, Q♣︎, 9♣︎, J♠︎, A♥︎, 8♥︎, 9♥︎, J♣︎, Q♠︎, 8♠︎, 7♠︎, 7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + cheyenne.chooseCard(c(EIGHT, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, cheyenne, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[A♦︎, Q♦︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[K♦︎]", cheyenne.getCards().toString()); + assertEquals("[9♦︎, 9♠︎, 10♠︎]", jacqueline.getCards().toString()); + assertEquals("[7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[8♦︎, 10♦︎, 10♣︎, Q♣︎, 9♣︎, J♠︎, A♥︎, 8♥︎, 9♥︎, J♣︎, Q♠︎, 8♠︎, 7♠︎, 7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + cheyenne.mau(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, cheyenne, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[A♦︎, Q♦︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[K♦︎]", cheyenne.getCards().toString()); + assertEquals("[9♦︎, 9♠︎, 10♠︎]", jacqueline.getCards().toString()); + assertEquals("[7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[8♦︎, 10♦︎, 10♣︎, Q♣︎, 9♣︎, J♠︎, A♥︎, 8♥︎, 9♥︎, J♣︎, Q♠︎, 8♠︎, 7♠︎, 7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(QUEEN, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(cheyenne, jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[K♦︎]", cheyenne.getCards().toString()); + assertEquals("[9♦︎, 9♠︎, 10♠︎]", jacqueline.getCards().toString()); + assertEquals("[A♦︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[Q♦︎, 8♦︎, 10♦︎, 10♣︎, Q♣︎, 9♣︎, J♠︎, A♥︎, 8♥︎, 9♥︎, J♣︎, Q♠︎, 8♠︎, 7♠︎, 7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + cheyenne.chooseCard(c(KING, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal, cheyenne), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♦︎, 9♠︎, 10♠︎]", jacqueline.getCards().toString()); + assertEquals("[A♦︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[]", cheyenne.getCards().toString()); + assertEquals("[7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[K♦︎, Q♦︎, 8♦︎, 10♦︎, 10♣︎, Q♣︎, 9♣︎, J♠︎, A♥︎, 8♥︎, 9♥︎, J♣︎, Q♠︎, 8♠︎, 7♠︎, 7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + cheyenne.maumau(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(cheyenne), game.getRanking()); + assertEquals("[9♦︎, 9♠︎, 10♠︎]", jacqueline.getCards().toString()); + assertEquals("[A♦︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[K♦︎, Q♦︎, 8♦︎, 10♦︎, 10♣︎, Q♣︎, 9♣︎, J♠︎, A♥︎, 8♥︎, 9♥︎, J♣︎, Q♠︎, 8♠︎, 7♠︎, 7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(NINE, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(cheyenne), game.getRanking()); + assertEquals("[A♦︎, J♦︎]", chantal.getCards().toString()); + assertEquals("[9♠︎, 10♠︎]", jacqueline.getCards().toString()); + assertEquals("[7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[9♦︎, K♦︎, Q♦︎, 8♦︎, 10♦︎, 10♣︎, Q♣︎, 9♣︎, J♠︎, A♥︎, 8♥︎, 9♥︎, J♣︎, Q♠︎, 8♠︎, 7♠︎, 7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(ACE, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(cheyenne), game.getRanking()); + assertEquals("[9♠︎, 10♠︎]", jacqueline.getCards().toString()); + assertEquals("[J♦︎]", chantal.getCards().toString()); + assertEquals("[7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[A♦︎, 9♦︎, K♦︎, Q♦︎, 8♦︎, 10♦︎, 10♣︎, Q♣︎, 9♣︎, J♠︎, A♥︎, 8♥︎, 9♥︎, J♣︎, Q♠︎, 8♠︎, 7♠︎, 7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.mau(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(cheyenne), game.getRanking()); + assertEquals("[9♠︎, 10♠︎]", jacqueline.getCards().toString()); + assertEquals("[J♦︎]", chantal.getCards().toString()); + assertEquals("[7♦︎, 8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[A♦︎, 9♦︎, K♦︎, Q♦︎, 8♦︎, 10♦︎, 10♣︎, Q♣︎, 9♣︎, J♠︎, A♥︎, 8♥︎, 9♥︎, J♣︎, Q♠︎, 8♠︎, 7♠︎, 7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(cheyenne), game.getRanking()); + assertEquals("[J♦︎]", chantal.getCards().toString()); + assertEquals("[9♠︎, 10♠︎, 7♦︎]", jacqueline.getCards().toString()); + assertEquals("[8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[A♦︎, 9♦︎, K♦︎, Q♦︎, 8♦︎, 10♦︎, 10♣︎, Q♣︎, 9♣︎, J♠︎, A♥︎, 8♥︎, 9♥︎, J♣︎, Q♠︎, 8♠︎, 7♠︎, 7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(JACK, DIAMONDS)); + assertEquals(CHOOSE_SUIT, game.getGameState()); + assertEquals(List.of(chantal, jacqueline), game.getPlayers()); + assertEquals(List.of(cheyenne), game.getRanking()); + assertEquals("[]", chantal.getCards().toString()); + assertEquals("[9♠︎, 10♠︎, 7♦︎]", jacqueline.getCards().toString()); + assertEquals("[8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[J♦︎, A♦︎, 9♦︎, K♦︎, Q♦︎, 8♦︎, 10♦︎, 10♣︎, Q♣︎, 9♣︎, J♠︎, A♥︎, 8♥︎, 9♥︎, J♣︎, Q♠︎, 8♠︎, 7♠︎, 7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseSuit(DIAMONDS); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(cheyenne), game.getRanking()); + assertEquals("[9♠︎, 10♠︎, 7♦︎]", jacqueline.getCards().toString()); + assertEquals("[]", chantal.getCards().toString()); + assertEquals("[8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[J♦︎, A♦︎, 9♦︎, K♦︎, Q♦︎, 8♦︎, 10♦︎, 10♣︎, Q♣︎, 9♣︎, J♠︎, A♥︎, 8♥︎, 9♥︎, J♣︎, Q♠︎, 8♠︎, 7♠︎, 7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertEquals(DIAMONDS, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.maumau(); + assertEquals(GAME_OVER, game.getGameState()); + assertEquals(List.of(), game.getPlayers()); + assertEquals(List.of(cheyenne, chantal, jacqueline), game.getRanking()); + assertEquals("[8♣︎, A♣︎, Q♥︎, K♣︎, 10♥︎, A♠︎, K♠︎, J♥︎]", game.getDrawPile().toString()); + assertEquals("[J♦︎, A♦︎, 9♦︎, K♦︎, Q♦︎, 8♦︎, 10♦︎, 10♣︎, Q♣︎, 9♣︎, J♠︎, A♥︎, 8♥︎, 9♥︎, J♣︎, Q♠︎, 8♠︎, 7♠︎, 7♣︎, 7♥︎, K♥︎]", game.getDiscardPile().toString()); + assertEquals(DIAMONDS, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + } +} \ No newline at end of file diff --git a/test/cards/maumau/model/MauMau9Test.java b/test/cards/maumau/model/MauMau9Test.java new file mode 100644 index 0000000..0de4807 --- /dev/null +++ b/test/cards/maumau/model/MauMau9Test.java @@ -0,0 +1,403 @@ +package cards.maumau.model; + +import cards.Card; +import cards.Rank; +import cards.Suit; +import org.junit.Test; + +import java.util.List; + +import static cards.Rank.ACE; +import static cards.Rank.EIGHT; +import static cards.Rank.JACK; +import static cards.Rank.KING; +import static cards.Rank.NINE; +import static cards.Rank.QUEEN; +import static cards.Rank.SEVEN; +import static cards.Rank.TEN; +import static cards.Suit.CLUBS; +import static cards.Suit.DIAMONDS; +import static cards.Suit.HEARTS; +import static cards.Suit.SPADES; +import static cards.maumau.model.GameState.CHOOSE_SUIT; +import static cards.maumau.model.GameState.GAME_INITIALIZED; +import static cards.maumau.model.GameState.GAME_OVER; +import static cards.maumau.model.GameState.PLAY; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class MauMau9Test { + private static Card c(Rank r, Suit s) { + return new Card(r, s); + } + + @Test + public void game() { + final List deck = List.of(c(ACE, HEARTS), c(SEVEN, CLUBS), c(EIGHT, DIAMONDS), c(TEN, CLUBS), c(QUEEN, HEARTS), c(TEN, SPADES), c(SEVEN, DIAMONDS), c(SEVEN, HEARTS), c(KING, DIAMONDS), c(JACK, CLUBS), c(NINE, DIAMONDS), c(TEN, HEARTS), c(SEVEN, SPADES), c(KING, CLUBS), c(KING, HEARTS), c(QUEEN, DIAMONDS), c(NINE, CLUBS), c(ACE, SPADES), c(EIGHT, HEARTS), c(TEN, DIAMONDS), c(JACK, DIAMONDS), c(ACE, CLUBS), c(QUEEN, CLUBS), c(JACK, HEARTS), c(NINE, SPADES), c(EIGHT, SPADES), c(QUEEN, SPADES), c(JACK, SPADES), c(ACE, DIAMONDS), c(NINE, HEARTS), c(KING, SPADES), c(EIGHT, CLUBS)); + final MauMau game = new MauMau(4, deck); + final Player jacqueline = game.addPlayer("Jacqueline"); + final Player chantal = game.addPlayer("Chantal"); + final Player cheyenne = game.addPlayer("Cheyenne"); + + assertEquals(GAME_INITIALIZED, game.getGameState()); + assertEquals(List.of(jacqueline, chantal, cheyenne), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[]", jacqueline.getCards().toString()); + assertEquals("[]", chantal.getCards().toString()); + assertEquals("[]", cheyenne.getCards().toString()); + assertEquals("[A♥︎, 7♣︎, 8♦︎, 10♣︎, Q♥︎, 10♠︎, 7♦︎, 7♥︎, K♦︎, J♣︎, 9♦︎, 10♥︎, 7♠︎, K♣︎, K♥︎, Q♦︎, 9♣︎, A♠︎, 8♥︎, 10♦︎, J♦︎, A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + game.startGame(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal, cheyenne), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[A♥︎, 10♣︎, 7♦︎, J♣︎]", jacqueline.getCards().toString()); + assertEquals("[7♣︎, Q♥︎, 7♥︎, 9♦︎]", chantal.getCards().toString()); + assertEquals("[8♦︎, 10♠︎, K♦︎, 10♥︎]", cheyenne.getCards().toString()); + assertEquals("[K♣︎, K♥︎, Q♦︎, 9♣︎, A♠︎, 8♥︎, 10♦︎, J♦︎, A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[7♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(SEVEN, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, cheyenne, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[7♣︎, Q♥︎, 7♥︎, 9♦︎]", chantal.getCards().toString()); + assertEquals("[8♦︎, 10♠︎, K♦︎, 10♥︎]", cheyenne.getCards().toString()); + assertEquals("[A♥︎, 10♣︎, J♣︎]", jacqueline.getCards().toString()); + assertEquals("[K♣︎, K♥︎, Q♦︎, 9♣︎, A♠︎, 8♥︎, 10♦︎, J♦︎, A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[7♦︎, 7♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(1, game.get7Counter()); + + chantal.chooseCard(c(SEVEN, HEARTS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(cheyenne, jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♦︎, 10♠︎, K♦︎, 10♥︎]", cheyenne.getCards().toString()); + assertEquals("[A♥︎, 10♣︎, J♣︎]", jacqueline.getCards().toString()); + assertEquals("[7♣︎, Q♥︎, 9♦︎]", chantal.getCards().toString()); + assertEquals("[K♣︎, K♥︎, Q♦︎, 9♣︎, A♠︎, 8♥︎, 10♦︎, J♦︎, A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[7♥︎, 7♦︎, 7♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(2, game.get7Counter()); + + cheyenne.no7(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(cheyenne, jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♦︎, 10♠︎, K♦︎, 10♥︎, K♣︎, K♥︎, Q♦︎, 9♣︎]", cheyenne.getCards().toString()); + assertEquals("[A♥︎, 10♣︎, J♣︎]", jacqueline.getCards().toString()); + assertEquals("[7♣︎, Q♥︎, 9♦︎]", chantal.getCards().toString()); + assertEquals("[A♠︎, 8♥︎, 10♦︎, J♦︎, A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[7♥︎, 7♦︎, 7♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + cheyenne.chooseCard(c(TEN, HEARTS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal, cheyenne), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[A♥︎, 10♣︎, J♣︎]", jacqueline.getCards().toString()); + assertEquals("[7♣︎, Q♥︎, 9♦︎]", chantal.getCards().toString()); + assertEquals("[8♦︎, 10♠︎, K♦︎, K♣︎, K♥︎, Q♦︎, 9♣︎]", cheyenne.getCards().toString()); + assertEquals("[A♠︎, 8♥︎, 10♦︎, J♦︎, A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[10♥︎, 7♥︎, 7♦︎, 7♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(TEN, CLUBS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, cheyenne, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[7♣︎, Q♥︎, 9♦︎]", chantal.getCards().toString()); + assertEquals("[8♦︎, 10♠︎, K♦︎, K♣︎, K♥︎, Q♦︎, 9♣︎]", cheyenne.getCards().toString()); + assertEquals("[A♥︎, J♣︎]", jacqueline.getCards().toString()); + assertEquals("[A♠︎, 8♥︎, 10♦︎, J♦︎, A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[10♣︎, 10♥︎, 7♥︎, 7♦︎, 7♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(SEVEN, CLUBS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(cheyenne, jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♦︎, 10♠︎, K♦︎, K♣︎, K♥︎, Q♦︎, 9♣︎]", cheyenne.getCards().toString()); + assertEquals("[A♥︎, J♣︎]", jacqueline.getCards().toString()); + assertEquals("[Q♥︎, 9♦︎]", chantal.getCards().toString()); + assertEquals("[A♠︎, 8♥︎, 10♦︎, J♦︎, A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[7♣︎, 10♣︎, 10♥︎, 7♥︎, 7♦︎, 7♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(1, game.get7Counter()); + + cheyenne.no7(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(cheyenne, jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♦︎, 10♠︎, K♦︎, K♣︎, K♥︎, Q♦︎, 9♣︎, A♠︎, 8♥︎]", cheyenne.getCards().toString()); + assertEquals("[A♥︎, J♣︎]", jacqueline.getCards().toString()); + assertEquals("[Q♥︎, 9♦︎]", chantal.getCards().toString()); + assertEquals("[10♦︎, J♦︎, A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[7♣︎, 10♣︎, 10♥︎, 7♥︎, 7♦︎, 7♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + cheyenne.chooseCard(c(KING, CLUBS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal, cheyenne), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[A♥︎, J♣︎]", jacqueline.getCards().toString()); + assertEquals("[Q♥︎, 9♦︎]", chantal.getCards().toString()); + assertEquals("[8♦︎, 10♠︎, K♦︎, K♥︎, Q♦︎, 9♣︎, A♠︎, 8♥︎]", cheyenne.getCards().toString()); + assertEquals("[10♦︎, J♦︎, A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[K♣︎, 7♣︎, 10♣︎, 10♥︎, 7♥︎, 7♦︎, 7♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(JACK, CLUBS)); + assertEquals(CHOOSE_SUIT, game.getGameState()); + assertEquals(List.of(jacqueline, chantal, cheyenne), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[A♥︎]", jacqueline.getCards().toString()); + assertEquals("[Q♥︎, 9♦︎]", chantal.getCards().toString()); + assertEquals("[8♦︎, 10♠︎, K♦︎, K♥︎, Q♦︎, 9♣︎, A♠︎, 8♥︎]", cheyenne.getCards().toString()); + assertEquals("[10♦︎, J♦︎, A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[J♣︎, K♣︎, 7♣︎, 10♣︎, 10♥︎, 7♥︎, 7♦︎, 7♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseSuit(HEARTS); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, cheyenne, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[Q♥︎, 9♦︎]", chantal.getCards().toString()); + assertEquals("[8♦︎, 10♠︎, K♦︎, K♥︎, Q♦︎, 9♣︎, A♠︎, 8♥︎]", cheyenne.getCards().toString()); + assertEquals("[A♥︎]", jacqueline.getCards().toString()); + assertEquals("[10♦︎, J♦︎, A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[J♣︎, K♣︎, 7♣︎, 10♣︎, 10♥︎, 7♥︎, 7♦︎, 7♠︎]", game.getDiscardPile().toString()); + assertEquals(HEARTS, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.mau(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, cheyenne, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[Q♥︎, 9♦︎]", chantal.getCards().toString()); + assertEquals("[8♦︎, 10♠︎, K♦︎, K♥︎, Q♦︎, 9♣︎, A♠︎, 8♥︎]", cheyenne.getCards().toString()); + assertEquals("[A♥︎]", jacqueline.getCards().toString()); + assertEquals("[10♦︎, J♦︎, A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[J♣︎, K♣︎, 7♣︎, 10♣︎, 10♥︎, 7♥︎, 7♦︎, 7♠︎]", game.getDiscardPile().toString()); + assertEquals(HEARTS, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(QUEEN, HEARTS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(cheyenne, jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♦︎, 10♠︎, K♦︎, K♥︎, Q♦︎, 9♣︎, A♠︎, 8♥︎]", cheyenne.getCards().toString()); + assertEquals("[A♥︎]", jacqueline.getCards().toString()); + assertEquals("[9♦︎]", chantal.getCards().toString()); + assertEquals("[10♦︎, J♦︎, A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[Q♥︎, J♣︎, K♣︎, 7♣︎, 10♣︎, 10♥︎, 7♥︎, 7♦︎, 7♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.mau(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(cheyenne, jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♦︎, 10♠︎, K♦︎, K♥︎, Q♦︎, 9♣︎, A♠︎, 8♥︎]", cheyenne.getCards().toString()); + assertEquals("[A♥︎]", jacqueline.getCards().toString()); + assertEquals("[9♦︎]", chantal.getCards().toString()); + assertEquals("[10♦︎, J♦︎, A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[Q♥︎, J♣︎, K♣︎, 7♣︎, 10♣︎, 10♥︎, 7♥︎, 7♦︎, 7♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + cheyenne.chooseCard(c(EIGHT, HEARTS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, cheyenne, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♦︎]", chantal.getCards().toString()); + assertEquals("[8♦︎, 10♠︎, K♦︎, K♥︎, Q♦︎, 9♣︎, A♠︎]", cheyenne.getCards().toString()); + assertEquals("[A♥︎]", jacqueline.getCards().toString()); + assertEquals("[10♦︎, J♦︎, A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[8♥︎, Q♥︎, J♣︎, K♣︎, 7♣︎, 10♣︎, 10♥︎, 7♥︎, 7♦︎, 7♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(cheyenne, jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[8♦︎, 10♠︎, K♦︎, K♥︎, Q♦︎, 9♣︎, A♠︎]", cheyenne.getCards().toString()); + assertEquals("[A♥︎]", jacqueline.getCards().toString()); + assertEquals("[9♦︎, 10♦︎]", chantal.getCards().toString()); + assertEquals("[J♦︎, A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[8♥︎, Q♥︎, J♣︎, K♣︎, 7♣︎, 10♣︎, 10♥︎, 7♥︎, 7♦︎, 7♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + cheyenne.chooseCard(c(EIGHT, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, cheyenne, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[9♦︎, 10♦︎]", chantal.getCards().toString()); + assertEquals("[10♠︎, K♦︎, K♥︎, Q♦︎, 9♣︎, A♠︎]", cheyenne.getCards().toString()); + assertEquals("[A♥︎]", jacqueline.getCards().toString()); + assertEquals("[J♦︎, A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[8♦︎, 8♥︎, Q♥︎, J♣︎, K♣︎, 7♣︎, 10♣︎, 10♥︎, 7♥︎, 7♦︎, 7♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(NINE, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(cheyenne, jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[10♠︎, K♦︎, K♥︎, Q♦︎, 9♣︎, A♠︎]", cheyenne.getCards().toString()); + assertEquals("[A♥︎]", jacqueline.getCards().toString()); + assertEquals("[10♦︎]", chantal.getCards().toString()); + assertEquals("[J♦︎, A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[9♦︎, 8♦︎, 8♥︎, Q♥︎, J♣︎, K♣︎, 7♣︎, 10♣︎, 10♥︎, 7♥︎, 7♦︎, 7♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.mau(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(cheyenne, jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[10♠︎, K♦︎, K♥︎, Q♦︎, 9♣︎, A♠︎]", cheyenne.getCards().toString()); + assertEquals("[A♥︎]", jacqueline.getCards().toString()); + assertEquals("[10♦︎]", chantal.getCards().toString()); + assertEquals("[J♦︎, A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[9♦︎, 8♦︎, 8♥︎, Q♥︎, J♣︎, K♣︎, 7♣︎, 10♣︎, 10♥︎, 7♥︎, 7♦︎, 7♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + cheyenne.chooseCard(c(KING, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, chantal, cheyenne), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[A♥︎]", jacqueline.getCards().toString()); + assertEquals("[10♦︎]", chantal.getCards().toString()); + assertEquals("[10♠︎, K♥︎, Q♦︎, 9♣︎, A♠︎]", cheyenne.getCards().toString()); + assertEquals("[J♦︎, A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[K♦︎, 9♦︎, 8♦︎, 8♥︎, Q♥︎, J♣︎, K♣︎, 7♣︎, 10♣︎, 10♥︎, 7♥︎, 7♦︎, 7♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.skip(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(chantal, cheyenne, jacqueline), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[10♦︎]", chantal.getCards().toString()); + assertEquals("[10♠︎, K♥︎, Q♦︎, 9♣︎, A♠︎]", cheyenne.getCards().toString()); + assertEquals("[A♥︎, J♦︎]", jacqueline.getCards().toString()); + assertEquals("[A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[K♦︎, 9♦︎, 8♦︎, 8♥︎, Q♥︎, J♣︎, K♣︎, 7♣︎, 10♣︎, 10♥︎, 7♥︎, 7♦︎, 7♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.chooseCard(c(TEN, DIAMONDS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(cheyenne, jacqueline, chantal), game.getPlayers()); + assertEquals(List.of(), game.getRanking()); + assertEquals("[10♠︎, K♥︎, Q♦︎, 9♣︎, A♠︎]", cheyenne.getCards().toString()); + assertEquals("[A♥︎, J♦︎]", jacqueline.getCards().toString()); + assertEquals("[]", chantal.getCards().toString()); + assertEquals("[A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[10♦︎, K♦︎, 9♦︎, 8♦︎, 8♥︎, Q♥︎, J♣︎, K♣︎, 7♣︎, 10♣︎, 10♥︎, 7♥︎, 7♦︎, 7♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + chantal.maumau(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(cheyenne, jacqueline), game.getPlayers()); + assertEquals(List.of(chantal), game.getRanking()); + assertEquals("[10♠︎, K♥︎, Q♦︎, 9♣︎, A♠︎]", cheyenne.getCards().toString()); + assertEquals("[A♥︎, J♦︎]", jacqueline.getCards().toString()); + assertEquals("[A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[10♦︎, K♦︎, 9♦︎, 8♦︎, 8♥︎, Q♥︎, J♣︎, K♣︎, 7♣︎, 10♣︎, 10♥︎, 7♥︎, 7♦︎, 7♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + cheyenne.chooseCard(c(TEN, SPADES)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, cheyenne), game.getPlayers()); + assertEquals(List.of(chantal), game.getRanking()); + assertEquals("[A♥︎, J♦︎]", jacqueline.getCards().toString()); + assertEquals("[K♥︎, Q♦︎, 9♣︎, A♠︎]", cheyenne.getCards().toString()); + assertEquals("[A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[10♠︎, 10♦︎, K♦︎, 9♦︎, 8♦︎, 8♥︎, Q♥︎, J♣︎, K♣︎, 7♣︎, 10♣︎, 10♥︎, 7♥︎, 7♦︎, 7♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(JACK, DIAMONDS)); + assertEquals(CHOOSE_SUIT, game.getGameState()); + assertEquals(List.of(jacqueline, cheyenne), game.getPlayers()); + assertEquals(List.of(chantal), game.getRanking()); + assertEquals("[A♥︎]", jacqueline.getCards().toString()); + assertEquals("[K♥︎, Q♦︎, 9♣︎, A♠︎]", cheyenne.getCards().toString()); + assertEquals("[A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[J♦︎, 10♠︎, 10♦︎, K♦︎, 9♦︎, 8♦︎, 8♥︎, Q♥︎, J♣︎, K♣︎, 7♣︎, 10♣︎, 10♥︎, 7♥︎, 7♦︎, 7♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseSuit(HEARTS); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(cheyenne, jacqueline), game.getPlayers()); + assertEquals(List.of(chantal), game.getRanking()); + assertEquals("[K♥︎, Q♦︎, 9♣︎, A♠︎]", cheyenne.getCards().toString()); + assertEquals("[A♥︎]", jacqueline.getCards().toString()); + assertEquals("[A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[J♦︎, 10♠︎, 10♦︎, K♦︎, 9♦︎, 8♦︎, 8♥︎, Q♥︎, J♣︎, K♣︎, 7♣︎, 10♣︎, 10♥︎, 7♥︎, 7♦︎, 7♠︎]", game.getDiscardPile().toString()); + assertEquals(HEARTS, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.mau(); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(cheyenne, jacqueline), game.getPlayers()); + assertEquals(List.of(chantal), game.getRanking()); + assertEquals("[K♥︎, Q♦︎, 9♣︎, A♠︎]", cheyenne.getCards().toString()); + assertEquals("[A♥︎]", jacqueline.getCards().toString()); + assertEquals("[A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[J♦︎, 10♠︎, 10♦︎, K♦︎, 9♦︎, 8♦︎, 8♥︎, Q♥︎, J♣︎, K♣︎, 7♣︎, 10♣︎, 10♥︎, 7♥︎, 7♦︎, 7♠︎]", game.getDiscardPile().toString()); + assertEquals(HEARTS, game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + cheyenne.chooseCard(c(KING, HEARTS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(jacqueline, cheyenne), game.getPlayers()); + assertEquals(List.of(chantal), game.getRanking()); + assertEquals("[A♥︎]", jacqueline.getCards().toString()); + assertEquals("[Q♦︎, 9♣︎, A♠︎]", cheyenne.getCards().toString()); + assertEquals("[A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[K♥︎, J♦︎, 10♠︎, 10♦︎, K♦︎, 9♦︎, 8♦︎, 8♥︎, Q♥︎, J♣︎, K♣︎, 7♣︎, 10♣︎, 10♥︎, 7♥︎, 7♦︎, 7♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.chooseCard(c(ACE, HEARTS)); + assertEquals(PLAY, game.getGameState()); + assertEquals(List.of(cheyenne, jacqueline), game.getPlayers()); + assertEquals(List.of(chantal), game.getRanking()); + assertEquals("[Q♦︎, 9♣︎, A♠︎]", cheyenne.getCards().toString()); + assertEquals("[]", jacqueline.getCards().toString()); + assertEquals("[A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[A♥︎, K♥︎, J♦︎, 10♠︎, 10♦︎, K♦︎, 9♦︎, 8♦︎, 8♥︎, Q♥︎, J♣︎, K♣︎, 7♣︎, 10♣︎, 10♥︎, 7♥︎, 7♦︎, 7♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + + jacqueline.maumau(); + assertEquals(GAME_OVER, game.getGameState()); + assertEquals(List.of(), game.getPlayers()); + assertEquals(List.of(chantal, jacqueline, cheyenne), game.getRanking()); + assertEquals("[A♣︎, Q♣︎, J♥︎, 9♠︎, 8♠︎, Q♠︎, J♠︎, A♦︎, 9♥︎, K♠︎, 8♣︎]", game.getDrawPile().toString()); + assertEquals("[A♥︎, K♥︎, J♦︎, 10♠︎, 10♦︎, K♦︎, 9♦︎, 8♦︎, 8♥︎, Q♥︎, J♣︎, K♣︎, 7♣︎, 10♣︎, 10♥︎, 7♥︎, 7♦︎, 7♠︎]", game.getDiscardPile().toString()); + assertNull(game.getChosenSuit()); + assertEquals(0, game.get7Counter()); + } +}