From d99f72daea105998f702c1e75408534e447eab9b Mon Sep 17 00:00:00 2001 From: selim Date: Tue, 30 Apr 2024 00:45:27 +0200 Subject: [PATCH] Beside category choices everything should work --- bin/domain/Hand.class | Bin 2803 -> 3086 bytes bin/facade/YahtzeeGame.class | Bin 10400 -> 10731 bytes bin/ui/TUI.class | Bin 4749 -> 4840 bytes src/domain/Hand.java | 21 ++++++++++++++++----- src/facade/YahtzeeGame.java | 16 +++++++++++++--- src/ui/TUI.java | 22 +++++++++++++--------- 6 files changed, 42 insertions(+), 17 deletions(-) diff --git a/bin/domain/Hand.class b/bin/domain/Hand.class index 8767774817c27f1c9d0445ed6dfbd6de9541bedc..6ae2bdc5ba5c75bfc341dc73561518b5ec931082 100644 GIT binary patch delta 1163 zcmZuw$xl;382?RQcOC%+q^v%zN>gf!>_#!7xCR%30`8W!K;g9yXmR0EO}LqOnZ$z! zV=pcjBSw4hV7z$o;Kl#Ii}CEui1>Stvbf|WGxNUho8R)y%=fDMKJUk0Z{Gpv!Ri{(Kvln$ zP8yN3v&nRJFgu%wruMmUS)k>#q0Jh)p3(HgST>}Y44O`gWO`gnrnRW9TNy2$jCCh6 z;c(cCtGMpMHGzu%psI+XOu#j566t9wNF`G8ni8;&sTh~{lxe4~B89XR_Pl*gMNB@i zCxln3j?daNIH1sPpVIRbox#_rsV|`YJ+>FnUH2H<y}= zj04t%7d=Pia1sc+@k>-!P?}Et0tFN5Tb6a*j;mQ=C!oGx37rWyt^D#ENQGz_>36Xc+99C)tNsSoZe7ws(?eo)}<~Wn_vFY{F1`#)|KAEdj`H1H{nVN y=;s_pcEjPftQie3w<2f9KXT06s^vfB+<;v4?rfO1AkF@Olq;`8;3ofUxb+(+y1^p= delta 790 zcmZXS&rcIk5XZl--EOzrZ6KB(EiI)|Q)^q09~OzBf`~}`6-mHaEVg1n@Syw$TsRsp zFP^;6cp&j432qDr<3T;>(Hq|M;MsUH)%x8nlr&yu-kUcwpP6~{H1Mlk|MYk7Er2W@ z?&vwE>{8-N&cJOsrL3!q2JWIL_mqmVVqi`dUCY8FKe)a`U%&+?!!A0r+sGt$5e%C+ z^A5cxMnhYO$~S6vXwxCW){}`#mDyby3;0;hR$ zV1Qm4oK?6)znpN7`{LxCL<`~w;FNsg9+m6bpr;RR^wT;ZUuqHmJp4@3%Fum+9MmQG zRSRz1+7u$xsN+X6zl(@cevJri5oHSr=h!v^Ny{VDXu`y7Q`q;T@{`b+J45ye44h>< zBS_#JhA>8%#W>Dmmb!=wNC8(6wMSJ#8hs4(pvUe~&^>l=vidy+wF*PD{)S#fhiIc_ zJ9#Xy6*u1mUyyiFrfT_&y6+_XbI4Ezlpx8Tl8mo?D9P0a^&X8&5^rkv+8{g zH&`i@pfZcjudDy-5!HHIk~O{ES8ie)_ojymCMI+C@|akz)V`%&u{6bAoeu5+SgwXL t@hilaxdCf(!`s<&2s`l~EO7`E59DWWy!)|TuGK!6ul_9ptGqd|_76Y_fGYq1 diff --git a/bin/facade/YahtzeeGame.class b/bin/facade/YahtzeeGame.class index 530daefe11d4a3a4dcd8b8993e4e968d29598784..1b610c74047f48f545af8e561822bbbf4c2f89f5 100644 GIT binary patch delta 4900 zcmcgwcX(7)7XO`BCzF>DCYgkpNlz$gL_(;chyoG~%_tG6A&f8(l9&t_u#5_#u>f){ zsHnjfMU=V&2J5;gx?%%S?7FT6yRN9HWY2w*n1tOw_uKEwcjw-7?>YCJ-zoRJG*A7q z-1*{()+Ygsr1{&O6`Hq4<Du06$r(>>#*@zW$v{Ylh1wSqjE487i zi!3a_1%&9D+KILG{Gw3$XJStEnFhj>mzcO;&Ka@!sfWr!b-%lsCs{cKRCHA7^tn` zOEYklh1KF`eIQ*c@{Hu9CiIl5++d*wXSmqBwHDUlMlstM=V*eka1(A84;v$sZndyM z8lg1=R`{K0!tECBz(&z#%uZQ~O&0FP0D@ydkyaHSI(P{zjm5Co1rqh3B!Kpf}W22ZDsY?UJi2YZeri2kQevY8I5_%!pj~Cy{AU zco8p|_&XuaRwc5xydmgkM<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uj1#y(?zJDKGRbfZKS}2j`0=}J;1AdS<=Vep`>$( getAllDiceNumbers() { diff --git a/src/facade/YahtzeeGame.java b/src/facade/YahtzeeGame.java index 3278e7f..3f1f7af 100644 --- a/src/facade/YahtzeeGame.java +++ b/src/facade/YahtzeeGame.java @@ -76,6 +76,12 @@ public class YahtzeeGame { } + public void autoLockInDices(int player) { + + players.get(player).hand.autoLockInDices(); + + } + public boolean allDicesLockedIn(int player) { return players.get(player).hand.getLockedInDiceAmount() == 5; @@ -157,13 +163,17 @@ public class YahtzeeGame { String highscores[][] = new String[10][3]; Scanner sc = new Scanner(new File("src/csv/highscores.csv")); + String mem[] = new String[3]; for (int i = 0; i < 10; i++) { if (sc.hasNextLine()) { - highscores[i][0] = sc.next(); - highscores[i][1] = sc.next(); - highscores[i][2] = sc.nextLine(); + + mem = sc.nextLine().split(" "); + highscores[i][0] = mem[0]; + highscores[i][1] = mem[1]; + highscores[i][2] = mem[2]; + System.out.println("test"); } else { highscores[i][0] = "___"; highscores[i][1] = "___"; diff --git a/src/ui/TUI.java b/src/ui/TUI.java index d773683..7d452dd 100644 --- a/src/ui/TUI.java +++ b/src/ui/TUI.java @@ -84,20 +84,24 @@ public class TUI { System.out.println("Free dices: " + game.getFreeDiceNumbers(i)); System.out.println("Locked in dices: " + game.getLockedInDiceNumbers(i)); - System.out.println( - "Type in which free dices you want to keep \n(seperated by space, type 'none' if you dont want to keep any): "); - choice = sc.nextLine(); - game.lockInDices(i, choice.split(" ")); - if ((game.getLeftRolls(i)) != 1) - System.out.println("\n" + game.getLeftRolls(i) + " rolls left"); - else - System.out.println("\n" + game.getLeftRolls(i) + " roll left"); + game.autoLockInDices(i); + if (!game.noMoreRolls(i)) { + System.out.println( + "Type in which free dices you want to keep \n(seperated by space, type 'none' if you dont want to keep any): "); + choice = sc.nextLine(); + game.lockInDices(i, choice.split(" ")); + + if ((game.getLeftRolls(i)) != 1) + System.out.println("\n" + game.getLeftRolls(i) + " rolls left"); + else if ((game.getLeftRolls(i)) == 1) + System.out.println("\n" + game.getLeftRolls(i) + " roll left"); + } } + System.out.println("\n\nLocked in dices: " + game.getLockedInDiceNumbers(i)); System.out.println("Done locking in... Here are your options: "); - System.out.println("Locked in dices: " + game.getLockedInDiceNumbers(i)); System.out.println(game.optionsPrinted(i)); System.out.println("Which option you want to select?: "); game.selectOption(i, sc.nextLine());