From 4d068a6a5a8af283ee510109302be51e920244e5 Mon Sep 17 00:00:00 2001 From: "s.eser" Date: Tue, 7 May 2024 12:02:04 +0200 Subject: [PATCH] Scanner Printer fixes --- bin/csv/highscores.csv | 2 +- bin/domain/Box.class | Bin 13154 -> 13135 bytes bin/domain/Player.class | Bin 705 -> 3100 bytes bin/facade/YahtzeeGame.class | Bin 11707 -> 11145 bytes bin/ui/TUI.class | Bin 5987 -> 5929 bytes src/csv/highscores.csv | 2 +- src/domain/Box.java | 2 +- src/domain/Player.java | 108 +++++++++++++++++++++- src/facade/YahtzeeGame.java | 167 ++++++++++++++++------------------- src/ui/TUI.java | 7 +- 10 files changed, 184 insertions(+), 104 deletions(-) diff --git a/bin/csv/highscores.csv b/bin/csv/highscores.csv index b7c8196..e76b1a3 100644 --- a/bin/csv/highscores.csv +++ b/bin/csv/highscores.csv @@ -7,4 +7,4 @@ ___ ___ 0 ___ ___ 0 ___ ___ 0 -___ ___ 0 +___ ___ 0 \ No newline at end of file diff --git a/bin/domain/Box.class b/bin/domain/Box.class index 6cdd89b64d62ac63162bb715ab0f3bc93c1d70c8..e00b4408fc2f3148d6cab66ed6885a97273d26c2 100644 GIT binary patch delta 2506 zcmcJQ>r>QK7{{Ln2-e+&6-a@`aR3!z7uXfAps3te)JUO-EY}4Wc5U6IWx-3AU)ud@ zb-JLIX<4LYX=d5{(i~63r4V5?*v$u?TnC(T9ZymUvW!gpe}OjZlzG zPt3PD#EQ)NdA$g!KA+DDKVi^L^Fs(FrQ%T5LUF@3Cv_9L#du~#dK4eXz<%*(rt6j% z!f>hBmX$9&S%-~?1qTt*+aiIQLbTvM`rffG%HI#r{vE+sK#e?zkkK3+jPcOJvIq^S z5rgKmhxYTpA)3=37z#wVdW@>3P+u_4)e{I=9kEbC9DZ_7%h zLDeamr{bXEU79zY2bJ$pIUNX0gLt+4Jx#(UR><`vzg5Xw6XdK6C z@mu9C>=AYDcv{m4Y!g1WH=ReCM207byG6ezFPCD>r?*U=(VXWM$2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P&fzs&$%Ztn862)8&xBEm>TkMFGc|H z3T(tAZ7Idv$2`D%nE5DEXFkq+lKC|AF!MR)^UN2SL(Es02J|b+Iq; R8eON2uJCL87QchJe*^7wH$?yd diff --git a/bin/domain/Player.class b/bin/domain/Player.class index dc8b686b87f79694c69b1fb7ad659e3949d6b96b..66f3cb13ee83dc39652b654b52b182a876fb6a99 100644 GIT binary patch literal 3100 zcmah~YjYGu6g?C2+;qqTk^sRNP$4e~qM#TEB*Z{;O#*o+px|V;Std+o;_Pf7RetgR z_(7{ksM0EbfIrIe+?io_(&@r4yEA?7IrsGK(|7*)_s_op%;IGmnjCbM!)@0KrdE7+ zPe*NNcF?os?z&UH8&sy2H@9>tcF-KS+uA{2u@PF0BQK~-GxppK$|NdgO!xT8RkAWi(OTBSC{XSY&$HIu=R!)c=3#bi=#)WkFJbuu-qLY3pj=z1%+M~8Xeo{ zfP)hXEof~+zk|-4lmbp-P*P7h=(ki!!DkfO(B6i#4hk8ViVGORpm4vh(1C(Hom1#U ztAp;M7wDzh_NI>3+)Y1ePFQmN4L9=SJzH#!pL_F#0&B zDs$=Bh5+s;+{Ubfma;UCjo&xL8PEbQP^=1b!Y#O~sU29tw{|38Ur&vFn$SXX!; zZB$k5^D3t$CGfq%hTMtcX+W3L5HllP)mdU9{Rf3d;;zoxPMQ0f3xis+{#4;dSwE4k zukY;Wh`U-Xg%L045H=Nl%EgP}%foT4P?C60ieC$3*RO-0D?F26R~Yzv%YkkPf1%(> zqX!NPudZ+&#kwq&0|g&r*(F=v)sZaztPl#WH_|k9kd#{qiAgpSD@0uaE^z3jFYn&O)_Zs)Fd+_`R8y*{y7@>e~Ot3UHm=Hw>=^RcX9j;y2mH> z(Kr4VPClG`gModV=JSv|zqgO!@yUIR{E-ly=kJ+>Oc8#Z)2AE#=%I*ST)+u@!1zc? zix2S;-&i1#Pi_A}D%#cT7JxTTP*BD6!H0l+I00vpj*wynnj`lhShgimODOqwC!~Uzj|XtvsA>@8+2{d9GS{I0fx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?2xoM^r6?bS*I{CZCo zo?rHcdAV2TN*8`}2h!D6NY^n(0`7Ne9M{gE$nzIYKph{)du-_Wka0TDPm&*XLnfO3 zUc!o7^jWC?=)%7&2b&#~!LZ!v_FDyV|99)H(N-LBeAt$x*zqCNECf5h(nHu^0O(8H3cF>XVcTm9H+)DSqxJ_MH`5jp0~_ z5!j4T*nuq8%|<(Na0t2lqK&~z$j4EP#c7P=_hvj^#Y9}jBwWE{zV;{KZA`&6OvU>s zz(=^3FVktbfkLuj201a4(lDC_po9#}p)8crILxJ~@KG^;HI<<}M)OfYOHoO6sHR5D zrxxBfVIghDVtNcqNbtAMJ}jdH@N?q#Qx|IJJWRTXI(iHB^bS_ibp+^R1eGL&lp$EH zWFf4KMN}z3vr>o_#^Y*a2_lX4lGm8;mI ze2A^eC)lQD;1M+w+f@TQ)GR!z-h;>0LhMwh;|a9{yHp?3A6&1h4%^1dCA~eS?d&QEwI*v{xpj&qUns}Va#Is9L<6kqxsA~ Mn$3&d#`%x_AIrAY&;S4c diff --git a/src/csv/highscores.csv b/src/csv/highscores.csv index b7c8196..e76b1a3 100644 --- a/src/csv/highscores.csv +++ b/src/csv/highscores.csv @@ -7,4 +7,4 @@ ___ ___ 0 ___ ___ 0 ___ ___ 0 -___ ___ 0 +___ ___ 0 \ No newline at end of file diff --git a/src/domain/Box.java b/src/domain/Box.java index 6eaf018..c33d82f 100644 --- a/src/domain/Box.java +++ b/src/domain/Box.java @@ -406,7 +406,7 @@ public class Box { } - public String selectedOptionsPrinted(int player) { + public String selectedOptionsPrinted() { StringBuilder sb = new StringBuilder(); diff --git a/src/domain/Player.java b/src/domain/Player.java index ad39041..dc63d22 100644 --- a/src/domain/Player.java +++ b/src/domain/Player.java @@ -1,11 +1,13 @@ package domain; +import java.util.ArrayList; + public class Player { - public String name; - public Hand hand; - public Box box; - public String savedGamemode; + private String name; + private Hand hand; + private Box box; + private String savedGamemode; public Player(String name, String gamemode) { @@ -22,5 +24,103 @@ public class Player { } + public String getPlayername(){ + return this.name; + } + public void rollDices(){ + this.hand.rollDices(); + + } + + public int getLeftRolls(){ + + return hand.getLeftRolls(); + } + + public ArrayList getAllDiceNumbers(){ + + return hand.getAllDiceNumbers(); + } + + public ArrayList getFreeDiceNumbers(){ + + return hand.getFreeDiceNumbers(); + } + + public ArrayList getLockedInDiceNumbers(){ + + return hand.getLockedInDiceNumbers(); + } + + public int getLockedInDiceAmount(){ + return hand.getLockedInDiceAmount(); + + } + + public void lockInDices(String... dices){ + + hand.lockInDices(dices); + } + + public boolean autoLockInDices(){ + + return hand.autoLockInDices(); + } + + public boolean allDicesLockedIn(){ + return allDicesLockedIn(); + + } + + public void evaluateAllOptions(){ + + box.evaluateBoxOptions(hand.getLockedInDiceNumbers()); + } + public ArrayList getAllOptions(){ + return box.getAllOptions(); + } + public void selectOption(String selectedOption){ + + box.selectOption(selectedOption); + } + + public void resetOptions(){ + box.resetOptions(); + + } + + public void updateBonus(){ + box.updateBonus(); + } + + public void updateUpperBoxScore(){ + box.updateUpperBoxScore(); + } + + public void updateLowerBoxScore(){ + box.updateLowerBoxScore(); + } + + public void updateTotalScore(){ + box.updateTotalScore(); + } + + public boolean onlyOneOption(){ + + return box.onlyOneOption(); + } + + public String selectedOptionsPrinted(){ + + return box.selectedOptionsPrinted(); + } + public boolean gameOver(){ + + return box.gameOver(); + } + + public int returnTotalPoints(){ + return box.returnTotalPoints(); + } } diff --git a/src/facade/YahtzeeGame.java b/src/facade/YahtzeeGame.java index 9bc4714..fd24b22 100644 --- a/src/facade/YahtzeeGame.java +++ b/src/facade/YahtzeeGame.java @@ -37,7 +37,7 @@ public class YahtzeeGame { } public String getPlayerName(int player) { - return players.get(player).name; + return players.get(player).getPlayername(); } public void setGamemode(String gamemode) { @@ -47,56 +47,56 @@ public class YahtzeeGame { public void rollDices(int player) { - players.get(player).hand.rollDices(); + players.get(player).rollDices(); } public ArrayList getAllDiceNumbers(int player) { - return players.get(player).hand.getAllDiceNumbers(); + return players.get(player).getAllDiceNumbers(); } public ArrayList getFreeDiceNumbers(int player) { - return players.get(player).hand.getFreeDiceNumbers(); + return players.get(player).getFreeDiceNumbers(); } public ArrayList getLockedInDiceNumbers(int player) { - return players.get(player).hand.getLockedInDiceNumbers(); + return players.get(player).getLockedInDiceNumbers(); } public int getLockedInDiceAmount(int player) { - return players.get(player).hand.getLockedInDiceAmount(); + return players.get(player).getLockedInDiceAmount(); } public void lockInDices(int player, String... dices) { if (dices[0].equalsIgnoreCase("none")) return; - players.get(player).hand.lockInDices(dices); + players.get(player).lockInDices(dices); } public boolean autoLockInDices(int player) { - return players.get(player).hand.autoLockInDices(); + return players.get(player).autoLockInDices(); } public boolean allDicesLockedIn(int player) { - return players.get(player).hand.getLockedInDiceAmount() == 5; + return players.get(player).getLockedInDiceAmount() == 5; } public int getLeftRolls(int player) { - return players.get(player).hand.getLeftRolls(); + return players.get(player).getLeftRolls(); } @@ -108,25 +108,25 @@ public class YahtzeeGame { public void evaluateAllOptions(int player) { - players.get(player).box.evaluateBoxOptions(players.get(player).hand.getLockedInDiceNumbers()); + players.get(player).evaluateAllOptions(); } public ArrayList getAllOptions(int player) { - return players.get(player).box.getAllOptions(); + return players.get(player).getAllOptions(); } public void selectOption(int player, String selectedOption) { - players.get(player).box.selectOption(selectedOption); - players.get(player).box.resetOptions(); + players.get(player).selectOption(selectedOption); + players.get(player).resetOptions(); players.get(player).getNewHand(); - players.get(player).box.updateBonus(); - players.get(player).box.updateUpperBoxScore(); - players.get(player).box.updateLowerBoxScore(); - players.get(player).box.updateTotalScore(); + players.get(player).updateBonus(); + players.get(player).updateUpperBoxScore(); + players.get(player).updateLowerBoxScore(); + players.get(player).updateTotalScore(); } @@ -146,18 +146,18 @@ public class YahtzeeGame { public boolean onlyOneOption(int player) { - return players.get(player).box.onlyOneOption(); + return players.get(player).onlyOneOption(); } public String selectedOptionsPrinted(int player) { - return players.get(player).box.selectedOptionsPrinted(player); + return players.get(player).selectedOptionsPrinted(); } public boolean gameOver(int player) { - return players.get(player).box.gameOver(); + return players.get(player).gameOver(); } @@ -165,7 +165,7 @@ public class YahtzeeGame { int counter = 0; for (int i = 0; i < playerCount; i++) { - if (players.get(i).box.gameOver()) + if (players.get(i).gameOver()) counter++; } @@ -174,8 +174,8 @@ public class YahtzeeGame { public int returnTotalPoints(int player) { - if (players.get(player).box.gameOver()) - return players.get(player).box.returnTotalPoints(); + if (players.get(player).gameOver()) + return players.get(player).returnTotalPoints(); else return 0; } @@ -183,49 +183,35 @@ public class YahtzeeGame { private String[][] refreshHighscoreList() throws FileNotFoundException { String highscores[][] = new String[10][3]; - Scanner sc = new Scanner(new File("src/csv/highscores.csv")); - Scanner scSp = new Scanner(new File("src/csv/highscoresSpecial8.csv")); String mem[] = new String[3]; - - if (savedGamemode.equalsIgnoreCase("Special8")) - - for (int i = 0; i < 10; i++) { - - if (scSp.hasNextLine()) { - - mem = scSp.nextLine().split(" "); - highscores[i][0] = mem[0]; - highscores[i][1] = mem[1]; - highscores[i][2] = mem[2]; - - } else { - highscores[i][0] = "___"; - highscores[i][1] = "___"; - highscores[i][2] = "0"; - } - - } + String source; + + if(savedGamemode.equalsIgnoreCase("Special8")) + source = "src/csv/highscoresSpecial8.csv"; else + source = "src/csv/highscores.csv"; + + Scanner sc = new Scanner(new File(source)); - for (int i = 0; i < 10; i++) { - if (sc.hasNextLine()) { + for (int i = 0; i < 10; i++) { - mem = sc.nextLine().split(" "); - highscores[i][0] = mem[0]; - highscores[i][1] = mem[1]; - highscores[i][2] = mem[2]; + if (sc.hasNextLine()) { - } else { - highscores[i][0] = "___"; - highscores[i][1] = "___"; - highscores[i][2] = "0"; - } + mem = sc.nextLine().split(" "); + highscores[i][0] = mem[0]; + highscores[i][1] = mem[1]; + highscores[i][2] = mem[2]; + } else { + highscores[i][0] = "___"; + highscores[i][1] = "___"; + highscores[i][2] = "0"; } + } + sc.close(); - scSp.close(); return highscores; } @@ -252,7 +238,7 @@ public class YahtzeeGame { if (i == 2) highscores[0][i] = "" + returnTotalPoints(player); else if (i == 1) - highscores[0][i] = "" + players.get(player).name; + highscores[0][i] = "" + players.get(player).getPlayername(); else if (i == 0) highscores[0][i] = "" + LocalDate.now(); highscoreMem2 = highscores[1][i]; @@ -281,7 +267,7 @@ public class YahtzeeGame { if (i == 2) highscores[1][i] = "" + returnTotalPoints(player); else if (i == 1) - highscores[1][i] = "" + players.get(player).name; + highscores[1][i] = "" + players.get(player).getPlayername(); else if (i == 0) highscores[1][i] = "" + LocalDate.now(); highscoreMem1 = highscores[2][i]; @@ -307,7 +293,7 @@ public class YahtzeeGame { if (i == 2) highscores[2][i] = "" + returnTotalPoints(player); else if (i == 1) - highscores[2][i] = "" + players.get(player).name; + highscores[2][i] = "" + players.get(player).getPlayername(); else if (i == 0) highscores[2][i] = "" + LocalDate.now(); highscoreMem2 = highscores[3][i]; @@ -331,7 +317,7 @@ public class YahtzeeGame { if (i == 2) highscores[3][i] = "" + returnTotalPoints(player); else if (i == 1) - highscores[3][i] = "" + players.get(player).name; + highscores[3][i] = "" + players.get(player).getPlayername(); else if (i == 0) highscores[3][i] = "" + LocalDate.now(); highscoreMem1 = highscores[4][i]; @@ -353,7 +339,7 @@ public class YahtzeeGame { if (i == 2) highscores[4][i] = "" + returnTotalPoints(player); else if (i == 1) - highscores[4][i] = "" + players.get(player).name; + highscores[4][i] = "" + players.get(player).getPlayername(); else if (i == 0) highscores[4][i] = "" + LocalDate.now(); highscoreMem2 = highscores[5][i]; @@ -373,7 +359,7 @@ public class YahtzeeGame { if (i == 2) highscores[5][i] = "" + returnTotalPoints(player); else if (i == 1) - highscores[5][i] = "" + players.get(player).name; + highscores[5][i] = "" + players.get(player).getPlayername(); else if (i == 0) highscores[5][i] = "" + LocalDate.now(); highscoreMem1 = highscores[6][i]; @@ -391,7 +377,7 @@ public class YahtzeeGame { if (i == 2) highscores[6][i] = "" + returnTotalPoints(player); else if (i == 1) - highscores[6][i] = "" + players.get(player).name; + highscores[6][i] = "" + players.get(player).getPlayername(); else if (i == 0) highscores[6][i] = "" + LocalDate.now(); highscoreMem2 = highscores[7][i]; @@ -407,7 +393,7 @@ public class YahtzeeGame { if (i == 2) highscores[7][i] = "" + returnTotalPoints(player); else if (i == 1) - highscores[7][i] = "" + players.get(player).name; + highscores[7][i] = "" + players.get(player).getPlayername(); else if (i == 0) highscores[7][i] = "" + LocalDate.now(); highscoreMem1 = highscores[8][i]; @@ -421,7 +407,7 @@ public class YahtzeeGame { if (i == 2) highscores[8][i] = "" + returnTotalPoints(player); else if (i == 1) - highscores[8][i] = "" + players.get(player).name; + highscores[8][i] = "" + players.get(player).getPlayername(); else if (i == 0) highscores[8][i] = "" + LocalDate.now(); highscores[9][i] = highscoreMem1; @@ -432,34 +418,31 @@ public class YahtzeeGame { if (i == 2) highscores[9][i] = "" + returnTotalPoints(player); else if (i == 1) - highscores[9][i] = "" + players.get(player).name; + highscores[9][i] = "" + players.get(player).getPlayername(); else if (i == 0) highscores[9][i] = "" + LocalDate.now(); } } - PrintWriter out = new PrintWriter(new FileWriter("src/csv/highscores.csv", false)); - PrintWriter outSp = new PrintWriter(new FileWriter("src/csv/highscoresSpecial8.csv", false)); - - if (savedGamemode.equalsIgnoreCase("Special8")) - for (int i = 0; i < 10; i++) { - - outSp.print(highscores[i][0] + " " + highscores[i][1] + " " - + highscores[i][2]); - - outSp.println(); - } + String source; + + if(savedGamemode.equalsIgnoreCase("Special8")) + source = "src/csv/highscoresSpecial8.csv"; else - for (int i = 0; i < 10; i++) { + source = "src/csv/highscores.csv"; + + PrintWriter out = new PrintWriter(new FileWriter(source)); - out.print(highscores[i][0] + " " + highscores[i][1] + " " - + highscores[i][2]); + + for (int i = 0; i < 10; i++) { - out.println(); - } + out.print(highscores[i][0] + " " + highscores[i][1] + " " + + highscores[i][2]); + + out.println(); + } out.close(); - outSp.close(); } catch (Exception e) { } @@ -492,16 +475,18 @@ public class YahtzeeGame { public void deleteHighscores() throws IOException { - PrintWriter out = new PrintWriter(new FileWriter("src/csv/highscores.csv", false)); - PrintWriter outSp = new PrintWriter(new FileWriter("src/csv/highscoresSpecial8.csv", false)); - - if (savedGamemode.equalsIgnoreCase("Special8")) - outSp.print(""); + String source; + + if(savedGamemode.equalsIgnoreCase("Special8")) + source = "src/csv/highscoresSpecial8.csv"; else - out.print(""); + source = "src/csv/highscores.csv"; + + PrintWriter out = new PrintWriter(new FileWriter(source)); + + out.print(""); out.close(); - outSp.close(); } diff --git a/src/ui/TUI.java b/src/ui/TUI.java index 797ebfa..a05fd1d 100644 --- a/src/ui/TUI.java +++ b/src/ui/TUI.java @@ -32,12 +32,7 @@ public class TUI { System.out.println("\nChoose your gamemode:"); System.out.println(">Normal"); System.out.println(">Special8"); - choice = sc.nextLine(); - if(choice.equalsIgnoreCase("Special8")) - game.setGamemode("Special8"); - else - game.setGamemode("Normal"); - System.out.println("\n" + game.showHighscores(choice)); + System.out.println("\n" + game.showHighscores(sc.nextLine())); } catch (FileNotFoundException e) { System.out.println("\nHighscore file not found!\n"); notFound = true;