Initial commit of tui
parent
8cadbcd55c
commit
0081a61c11
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -49,7 +49,7 @@ public class Box {
|
|||
this.savedGamemode = gamemode;
|
||||
}
|
||||
|
||||
public void evaluateUpperBoxOptions(ArrayList<Integer> diceNumbers) {
|
||||
private void evaluateUpperBoxOptions(ArrayList<Integer> diceNumbers) {
|
||||
|
||||
if (diceNumbers.contains(1))
|
||||
for (int i = 0; i < diceNumbers.size(); i++) {
|
||||
|
@ -93,7 +93,7 @@ public class Box {
|
|||
}
|
||||
}
|
||||
|
||||
public void evaluateLowerBoxOptions(ArrayList<Integer> diceNumbers) {
|
||||
private void evaluateLowerBoxOptions(ArrayList<Integer> diceNumbers) {
|
||||
int sumOfAllNumbers = 0;
|
||||
|
||||
for (int i = 0; i < diceNumbers.size(); i++) {
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
package domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
public class Player {
|
||||
|
||||
String name;
|
||||
Hand hand;
|
||||
Box box;
|
||||
String savedGamemode;
|
||||
public String name;
|
||||
public Hand hand;
|
||||
public Box box;
|
||||
public String savedGamemode;
|
||||
|
||||
public Player(String name, String gamemode) {
|
||||
|
||||
|
@ -24,12 +22,4 @@ public class Player {
|
|||
|
||||
}
|
||||
|
||||
public String getHighscore() {
|
||||
|
||||
if (box.gameOver())
|
||||
return "date: " + LocalDate.now().toString() + "\n" + name + ": " + box.returnTotalPoints();
|
||||
else
|
||||
return "";
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,4 +23,68 @@ public class YahtzeeGame {
|
|||
}
|
||||
}
|
||||
|
||||
public void rollDices(int player) {
|
||||
|
||||
players.get(player - 1).hand.rollDices();
|
||||
|
||||
}
|
||||
|
||||
public ArrayList<Integer> getAllDiceNumbers(int player) {
|
||||
|
||||
return players.get(player - 1).hand.getAllDiceNumbers();
|
||||
|
||||
}
|
||||
|
||||
public ArrayList<Integer> getFreeDiceNumbers(int player) {
|
||||
|
||||
return players.get(player - 1).hand.getFreeDiceNumbers();
|
||||
|
||||
}
|
||||
|
||||
public ArrayList<Integer> getLockedInDiceNumbers(int player) {
|
||||
|
||||
return players.get(player - 1).hand.getLockedInDiceNumbers();
|
||||
|
||||
}
|
||||
|
||||
public void lockInDices(int player, int... dices) {
|
||||
|
||||
players.get(player - 1).hand.lockInDices(dices);
|
||||
|
||||
}
|
||||
|
||||
public int getLeftRolls(int player) {
|
||||
|
||||
return players.get(player - 1).hand.getLeftRolls();
|
||||
|
||||
}
|
||||
|
||||
public ArrayList<String> getAllOptionsEvaluated(int player) {
|
||||
|
||||
players.get(player - 1).box.evaluateBoxOptions(players.get(player - 1).hand.getAllDiceNumbers());
|
||||
return players.get(player - 1).box.getAllOptions();
|
||||
|
||||
}
|
||||
|
||||
public void selectOption(int player, String selectedOption) {
|
||||
|
||||
players.get(player - 1).box.selectOption(selectedOption);
|
||||
players.get(player - 1).box.resetOptions();
|
||||
players.get(player - 1).getNewHand();
|
||||
|
||||
}
|
||||
|
||||
public boolean gameOver(int player) {
|
||||
|
||||
return players.get(player - 1).box.gameOver();
|
||||
|
||||
}
|
||||
|
||||
public int returnTotalPoints(int player) {
|
||||
|
||||
if (players.get(player - 1).box.gameOver())
|
||||
return players.get(player - 1).box.returnTotalPoints();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
package ui;
|
||||
|
||||
public class TUI {
|
||||
|
||||
}
|
Loading…
Reference in New Issue