First final version
parent
d99f72daea
commit
b0d4e94f2f
|
@ -1 +0,0 @@
|
|||
|
|
Binary file not shown.
Binary file not shown.
BIN
bin/ui/TUI.class
BIN
bin/ui/TUI.class
Binary file not shown.
|
@ -1 +0,0 @@
|
|||
|
|
|
@ -56,37 +56,37 @@ public class Box {
|
|||
if (diceNumbers.get(i) == 1)
|
||||
this.categoryOne += diceNumbers.get(i);
|
||||
}
|
||||
else if (diceNumbers.contains(2))
|
||||
if (diceNumbers.contains(2))
|
||||
for (int i = 0; i < diceNumbers.size(); i++) {
|
||||
if (diceNumbers.get(i) == 2)
|
||||
this.categoryTwo += diceNumbers.get(i);
|
||||
}
|
||||
else if (diceNumbers.contains(3))
|
||||
if (diceNumbers.contains(3))
|
||||
for (int i = 0; i < diceNumbers.size(); i++) {
|
||||
if (diceNumbers.get(i) == 3)
|
||||
this.categoryThree += diceNumbers.get(i);
|
||||
}
|
||||
else if (diceNumbers.contains(4))
|
||||
if (diceNumbers.contains(4))
|
||||
for (int i = 0; i < diceNumbers.size(); i++) {
|
||||
if (diceNumbers.get(i) == 4)
|
||||
this.categoryFour += diceNumbers.get(i);
|
||||
}
|
||||
else if (diceNumbers.contains(5))
|
||||
if (diceNumbers.contains(5))
|
||||
for (int i = 0; i < diceNumbers.size(); i++) {
|
||||
if (diceNumbers.get(i) == 5)
|
||||
this.categoryFive += diceNumbers.get(i);
|
||||
}
|
||||
else if (diceNumbers.contains(6))
|
||||
if (diceNumbers.contains(6))
|
||||
for (int i = 0; i < diceNumbers.size(); i++) {
|
||||
if (diceNumbers.get(i) == 6)
|
||||
this.categorySix += diceNumbers.get(i);
|
||||
}
|
||||
else if (diceNumbers.contains(7))
|
||||
if (diceNumbers.contains(7))
|
||||
for (int i = 0; i < diceNumbers.size(); i++) {
|
||||
if (diceNumbers.get(i) == 7)
|
||||
this.categorySeven += diceNumbers.get(i);
|
||||
}
|
||||
else if (diceNumbers.contains(8))
|
||||
if (diceNumbers.contains(8))
|
||||
for (int i = 0; i < diceNumbers.size(); i++) {
|
||||
if (diceNumbers.get(i) == 8)
|
||||
this.categoryEight += diceNumbers.get(i);
|
||||
|
@ -138,14 +138,14 @@ public class Box {
|
|||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
|
||||
if (counter[i] == 1 && counter[i + 1] == 1 && counter[i + 2] == 1)
|
||||
if (counter[i] >= 1 && counter[i + 1] >= 1 && counter[i + 2] >= 1)
|
||||
categorySmallStreet = 30;
|
||||
|
||||
}
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
|
||||
if (counter[i] == 1 && counter[i + 1] == 1 && counter[i + 2] == 1 && counter[i + 3] == 1)
|
||||
if (counter[i] >= 1 && counter[i + 1] >= 1 && counter[i + 2] >= 1 && counter[i + 3] >= 1)
|
||||
categoryBigStreet = 40;
|
||||
|
||||
}
|
||||
|
@ -340,11 +340,19 @@ public class Box {
|
|||
|
||||
public int returnTotalPoints() {
|
||||
|
||||
return setCategoryOne + setCategoryTwo + setCategoryThree + setCategoryFour + setCategoryFive
|
||||
+ setCategorySix + setCategorySeven + setCategoryEight + setCategoryTripleMatch + setCategoryFourOfAKind
|
||||
+ setCategoryFullHouse + setCategorySmallStreet + setCategoryBigStreet + setCategoryYahtzee
|
||||
+ setCategoryChance
|
||||
+ setCategoryR2D2;
|
||||
if (savedGamemode.equals("Special8"))
|
||||
return setCategoryOne + setCategoryTwo + setCategoryThree + setCategoryFour + setCategoryFive
|
||||
+ setCategorySix + setCategorySeven + setCategoryEight + setCategoryTripleMatch
|
||||
+ setCategoryFourOfAKind
|
||||
+ setCategoryFullHouse + setCategorySmallStreet + setCategoryBigStreet + setCategoryYahtzee
|
||||
+ setCategoryChance
|
||||
+ setCategoryR2D2;
|
||||
else
|
||||
|
||||
return setCategoryOne + setCategoryTwo + setCategoryThree + setCategoryFour + setCategoryFive
|
||||
+ setCategorySix + setCategoryTripleMatch + setCategoryFourOfAKind
|
||||
+ setCategoryFullHouse + setCategorySmallStreet + setCategoryBigStreet + setCategoryYahtzee
|
||||
+ setCategoryChance;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -100,9 +100,14 @@ public class YahtzeeGame {
|
|||
|
||||
}
|
||||
|
||||
public ArrayList<String> getAllOptionsEvaluated(int player) {
|
||||
public void evaluateAllOptions(int player) {
|
||||
|
||||
players.get(player).box.evaluateBoxOptions(players.get(player).hand.getLockedInDiceNumbers());
|
||||
|
||||
}
|
||||
|
||||
public ArrayList<String> getAllOptions(int player) {
|
||||
|
||||
players.get(player).box.evaluateBoxOptions(players.get(player).hand.getAllDiceNumbers());
|
||||
return players.get(player).box.getAllOptions();
|
||||
|
||||
}
|
||||
|
@ -119,9 +124,9 @@ public class YahtzeeGame {
|
|||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < getAllOptionsEvaluated(player).size(); i++) {
|
||||
for (int i = 0; i < getAllOptions(player).size(); i++) {
|
||||
|
||||
sb.append(getAllOptionsEvaluated(player).get(i) + "\n");
|
||||
sb.append(getAllOptions(player).get(i) + "\n");
|
||||
|
||||
}
|
||||
|
||||
|
@ -173,7 +178,7 @@ public class YahtzeeGame {
|
|||
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] = "___";
|
||||
|
@ -398,10 +403,10 @@ public class YahtzeeGame {
|
|||
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++) {
|
||||
out.print((i + 1) + ": " + LocalDate.now() + ": " + players.get(player).name + ": "
|
||||
+ returnTotalPoints(player));
|
||||
}
|
||||
|
||||
out.print(LocalDate.now() + ": " + players.get(player).name + ": "
|
||||
+ returnTotalPoints(player));
|
||||
|
||||
out.println();
|
||||
}
|
||||
|
||||
|
@ -426,8 +431,8 @@ public class YahtzeeGame {
|
|||
for (int i = 0; i < 10; i++) {
|
||||
|
||||
sb.append((i + 1) + ": " + refreshHighscoreList()[i][0]);
|
||||
sb.append(": " + refreshHighscoreList()[i][1]);
|
||||
sb.append(": " + refreshHighscoreList()[i][2] + "\n");
|
||||
sb.append(" " + refreshHighscoreList()[i][1]);
|
||||
sb.append(" " + refreshHighscoreList()[i][2] + "\n");
|
||||
|
||||
}
|
||||
|
||||
|
@ -439,7 +444,7 @@ public class YahtzeeGame {
|
|||
|
||||
PrintWriter out = new PrintWriter(new FileWriter("src/csv/highscores.csv", false));
|
||||
|
||||
out.println("");
|
||||
out.print("");
|
||||
|
||||
out.close();
|
||||
|
||||
|
|
|
@ -102,6 +102,7 @@ public class TUI {
|
|||
|
||||
System.out.println("\n\nLocked in dices: " + game.getLockedInDiceNumbers(i));
|
||||
System.out.println("Done locking in... Here are your options: ");
|
||||
game.evaluateAllOptions(i);
|
||||
System.out.println(game.optionsPrinted(i));
|
||||
System.out.println("Which option you want to select?: ");
|
||||
game.selectOption(i, sc.nextLine());
|
||||
|
|
Loading…
Reference in New Issue