From 5379345afa64a02bb026b85eef06bb6bee1b21bb Mon Sep 17 00:00:00 2001 From: "s.eser" Date: Sun, 28 Apr 2024 19:21:21 +0200 Subject: [PATCH] highscore delete function added --- bin/facade/YahtzeeGame.class | Bin 8501 -> 8808 bytes src/facade/YahtzeeGame.java | 16 ++++++++++++++-- src/ui/TUI.java | 21 +++++++++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/bin/facade/YahtzeeGame.class b/bin/facade/YahtzeeGame.class index 40990966fa16af94f876cc679e2039632bb3825e..9836209e8305ab64f3965751f7b0cf76bf4a232d 100644 GIT binary patch delta 2337 zcmcgtd34m(75={8I+;wi$-a+SAR%m~K@kWvIqYQ-t>L6dHIOkG7?SBEji7C(2(3V= zP=2kZE=8-7)>77YD9RKg>Idk5-_rC9LZ+_o> zua|a>x4+x7Z3lo74s5m`H^O5VR5Vl!^VANTGIMi}p(t(>hY07_)`=dkd$!+G@Ali# zfg=t?-~%EdZ(0c8t*EIQc5l7kQ&Tnid--K{w4*Z!`H+b1he+f;|IztnPGsP?0~>I{ ziV7OHkJE}y@4p4Yu-l*=A=UrlvIO{G@=?#1)n zzR+>~5}(^OW#)vh4R$*&W4T3pY|%9$@m8k3PD_92@m2=!qZ=`H5H}ro6hCqz6FtG+ zdabec!SUUsg9=r`sPOsRHI>AWJZmXqt#`~A>qUE<(M{7qo3-6OJT*m)=3(_|uf_Jgd`piDUa5Bym&jH~DdOXpXXRQfOvTDK~8yaI{5<%LSLfARV)&H|G zjnIOMjTwX*5?oe>BT369a;>%DiQ*q=n9L0f<|tycwbfCb9tRE4h(ZG5kcecY zNOx(tL-tZ+TE!8o^=!mQp#2eZm@jLlH6?NkhlQk1^6kDUC=CUMo zx;5%SeG+mo*-DSDiJR+DM3+ksx#m`WH$EBGS7>Sh_i&dC~Utl&?qYl5sVmyJB0j$BVuojK7 zuE#nw!NP0!wbb+*Y{!!l`YG&_({}t8op>6j@eI!6SzN_)=)v!3Vm+hqI1}-E4#Gd(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yh`0@)0bK;n(;L9z_!#!*VP^i)b%msbF$= z6~C3#k7GBMNq;>dP1uBE_?@)N@1-T4#1%Y6i$5@o2bhBuEWy((!!sO;XIY8oI29{7 z4K0k~PrMJ$b1`1v68xD>Sj83i3tO<7vDJ8ytysg&Sj+ABD|cfZ+p(U9v4J0=l_#;0 z=kbyPo>l>DQu%mA^}wsDKQ^mD*rG;btD1nntC{$Rs=+pOKVDM}*sd1gb@dqjsh+?N zwH!OuO1z;~<6mkccB!q{t#)9KdJ}CibpUUw4oUhE{;e)yuU6QngJ{=jcuV)fetiuN z=y7;k--Ls@8i(`@yrb{IyLvtj>-%v;H=sj5jHBA&J^du!*U#XXUWE_zddc+)j_Wp@ z(EISQK7>#7QGBY;qEml~lU@!^c?F1__6FjNcO5?SD)6~C7H7T5IOkR23-3;x_kM&6 zUL7ua_u_;X!zFJiu6Rx8@>U3WR+8S|sJt!I-a&fa5gP9_eeVLTQ4E-5CYcNdO+J%N zZ-&eOTroqKY9=zxOkujIV#Itu#tbu$ndWEAGLG4%i8qRL;+w~@ww~i{11H#rIMFWWB>TMVt3=Z0YrdLM<(XdJiEXk+nPUzFS>5C%0ZEz%hIPV;2gK2gniMHVU0SbY(?7 z+2L+4s%M&OE9x2Rkg12`Qbh?(AY+O`m9R*&C84w~@^nQD!X^17t@x-FA2*WuCF{|x zx$ERw@g{gIr#*mGFhZJC*>ibE0)6(?3}2yFGHT*bh=Fp_LVDK3m@N9I!f7U|z9gBn zcyD_do!{GtQ@7}mEf`r^5U*ZPuFE&!bo@v8d|K&Mizk-z|6?&?xp39es8|r6McYbS zadFMpXbYt_cqan93mGY#fnv@?Iq$|;F-&HSYb(x<;j#<~c?xi20<%hB4nkc_-5AFHk-7f`yZ5m` diff --git a/src/facade/YahtzeeGame.java b/src/facade/YahtzeeGame.java index ee20936..5e09331 100644 --- a/src/facade/YahtzeeGame.java +++ b/src/facade/YahtzeeGame.java @@ -1,6 +1,8 @@ package facade; import java.io.FileNotFoundException; +import java.io.FileWriter; +import java.io.IOException; import java.io.PrintWriter; import java.time.LocalDate; import java.util.ArrayList; @@ -111,7 +113,7 @@ public class YahtzeeGame { return highscores; } - public void setScoreToHighscores(int player, String highscores[][]) throws FileNotFoundException { + public void setScoreToHighscores(int player, String highscores[][]) throws IOException { String highscoreMem1 = ""; String highscoreMem2 = ""; @@ -321,7 +323,7 @@ public class YahtzeeGame { } } - PrintWriter out = new PrintWriter("src/csv/highscores.csv"); + PrintWriter out = new PrintWriter(new FileWriter("src/csv/highscores.csv", false)); for (int i = 0; i < 10; i++) { for (int s = 0; s < 3; s++) { @@ -360,4 +362,14 @@ public class YahtzeeGame { return sb.toString(); } + + public void deleteHighscores() throws IOException{ + + PrintWriter out = new PrintWriter(new FileWriter("src/csv/highscores.csv", false)); + + out.println(""); + + out.close(); + + } } diff --git a/src/ui/TUI.java b/src/ui/TUI.java index d9ecb19..7e3c31a 100644 --- a/src/ui/TUI.java +++ b/src/ui/TUI.java @@ -1,5 +1,26 @@ package ui; +import java.util.Scanner; + public class TUI { + public static void main(String[] args) { + + boolean choice = true; + Scanner df = new Scanner(System.in); + + System.out.println("Yahtzee Star Wars Special!"); + + while (choice) { + + System.out.println("Main menu:\n"); + System.out.println("Play"); + System.out.println("Highscores"); + + if(High) + + } + + } + }