From d58672a0974365d6c54e630070483fa22989ef0a Mon Sep 17 00:00:00 2001 From: peet Date: Mon, 20 May 2024 14:57:05 +0200 Subject: [PATCH] implemented all functions of PlayerHandler --- bin/cards/maumau/model/PlayerHandler.class | Bin 3142 -> 3396 bytes src/cards/maumau/model/PlayerHandler.java | 13 +++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/bin/cards/maumau/model/PlayerHandler.class b/bin/cards/maumau/model/PlayerHandler.class index d52ee669303ec9d3ff782341818de71915a69d5f..580b21d5c18b4af82515321c45d379126ecb174a 100644 GIT binary patch delta 1085 zcmZ`&O-~b16g_X+>D1{UAJWQ~g%qL`qBSN$1c4gVK&X`nA|fc$c7TBvupO!(T2ypz zX64evgsntlf(zrqkZAl5?p*T&jC$XjrW({v+PNq1-gD2n_jR}CV_n(jAMf4+IESYS zBzsQ^JlpeZhezB|AI34E;5x&>c|EU3RxC3eiJ3V|!wpO_D0(Ut({mPszcnT@()!|T zelezB??mZNjZ3inG9tkmY!U=q%V)^ ziL}9>&6ta3Zf-cOuNqlSYHFD0q`s_?S;`xN*M8|f9U8}?h9xYMKr?qCvuv$0xLU&# zyeO+72g@#(gNLXxXINK^jFCwg*#ls>V=u{HRh6R08fG!{I_{}r{u;ES7M-X=Kk5-j z5MyYxSCp6>f{JE)m!hK-9kb`Wjdq9kxZFmlolu;eu(wse{lyz$r+8Et!w|6tXxjad z=mC6fZ*Zi22iGKQ6O_0L}^L<?P^ z>NzX_?%)=~2P8#<&4R=l>RdPK)2hpW`F83P!kP7<16 zP$Xf7>gc|Fhs+Ms0gbCDBu`q4i{w{{ znh|->A z(6~VN32hLX6zBm8c2un{oZYW*niT5)QMiF}q39vqVCS0j6$e<^=1kDJ9&hnzKWz#X Uv}wK6KZT}$hfey@rZD!YOEUiifz^Otkt$P zEW#kDR{MIrX|EByiDW*61(Y;AfyuaH+Js1ADw&lhYeu7@&lIa>$-bzfLKxbdJ;LI{ zgmBI_O3Sy5=3S#$(0w64l@5;BGFTTSRi6Vs<#xRHp3}G6_a39CT z4>hZtLJ+6Lhd@je{Ap#FQCy;*e!tlDk1A(5lW;R*loA_SMBEJMq|4PtAh@39xp?@e zZMhid=wo%@JT7yLc8j>e!*f2u9Ksw457-QG9q37Mp$EkzrXNTndBMZvx1Qc8oU$xk|KSQeRyVIG$ai_4Gs$;@)U;;Os>+sgm z5IdnbWh8pasKaPRq9&tJElxR!o-wL2nv!FelFcRO0l9N T|Ialq{?$IY?Gsj|!RNmLxOIj@ diff --git a/src/cards/maumau/model/PlayerHandler.java b/src/cards/maumau/model/PlayerHandler.java index 70402af..85d9819 100644 --- a/src/cards/maumau/model/PlayerHandler.java +++ b/src/cards/maumau/model/PlayerHandler.java @@ -19,11 +19,14 @@ public class PlayerHandler { public PlayerHandler(MauMau game) { this.game = game; + + //Initialize all the States to be used this.waitForNextTurnState = new WaitForNextTurnState(this); this.waitForMauState = new WaitForMauState(this); this.waitForMauMauState = new WaitForMauMauState(this); this.finishedState = new FinishedState(); + //set waitingForNextTurnState as default this.currentState = waitForNextTurnState; } @@ -48,15 +51,17 @@ public class PlayerHandler { } public void addPlayer(Player player) { - // Add player logic + players.addLast(player); } public void localNextTurn(int n) { - // Local next turn logic + for(int i = 0; i < n; i++){ + players.addLast(players.getFirst()); + } } public void finishPlayer(Player p) { - // Finish player logic + ranking.addLast(players.removeFirst()); } public Player getCurrentPlayer() { @@ -92,6 +97,6 @@ public class PlayerHandler { } public void finishGame() { - // Finish game logic + finishPlayer(players.getFirst()); } }