2024-04-29 21:06:04 +02:00
|
|
|
package fassade;
|
|
|
|
|
|
|
|
import domain.Game;
|
|
|
|
import domain.Player;
|
2024-05-06 02:35:10 +02:00
|
|
|
import domain.Sheet;
|
|
|
|
import domain.sheets.Category;
|
2024-04-29 21:06:04 +02:00
|
|
|
|
2024-05-06 22:55:58 +02:00
|
|
|
import java.io.*;
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
import java.time.format.DateTimeFormatter;
|
2024-05-06 02:35:10 +02:00
|
|
|
import java.util.*;
|
2024-04-29 21:06:04 +02:00
|
|
|
|
|
|
|
public class KniffelSystem {
|
2024-05-06 22:55:58 +02:00
|
|
|
String lederboardLocation = "scores.csv";
|
2024-04-29 21:06:04 +02:00
|
|
|
ArrayList<String> playerColors;
|
2024-05-06 17:19:11 +02:00
|
|
|
ArrayList<Category> allValidCombinations = new ArrayList<>();
|
2024-04-29 21:06:04 +02:00
|
|
|
Game game;
|
|
|
|
public KniffelSystem(){
|
|
|
|
game = new Game();
|
|
|
|
playerColors = new ArrayList<>(Arrays.asList(
|
|
|
|
"\u001B[31m", // Quelle 2 Anfang
|
|
|
|
"\u001B[32m", //
|
|
|
|
"\u001B[34m", //
|
|
|
|
"\u001B[33m", //
|
|
|
|
"\u001B[36m")); // Quelle 2 Ende
|
|
|
|
}
|
|
|
|
|
2024-04-29 21:17:51 +02:00
|
|
|
|
2024-05-06 22:55:58 +02:00
|
|
|
public String setGamemode(String gamemode){
|
|
|
|
return game.setGamemode(gamemode);
|
|
|
|
}
|
|
|
|
|
|
|
|
private String getGamemode(){
|
|
|
|
return game.getGamemode();
|
2024-04-29 21:06:04 +02:00
|
|
|
}
|
|
|
|
|
2024-04-29 21:17:51 +02:00
|
|
|
|
2024-04-29 21:06:04 +02:00
|
|
|
public String addPlayer(int playerNumber, String name) {
|
|
|
|
String playerColor = colorPicker(playerNumber);
|
2024-05-06 22:55:58 +02:00
|
|
|
Player playerToAdd = new Player(playerNumber, name, playerColor, 0, getGamemode());
|
2024-04-29 21:06:04 +02:00
|
|
|
game.addPlayer(playerToAdd);
|
|
|
|
|
2024-05-06 02:35:10 +02:00
|
|
|
return changeStringFormat(name, playerColor);
|
2024-04-29 21:06:04 +02:00
|
|
|
}
|
|
|
|
|
2024-04-29 21:17:51 +02:00
|
|
|
|
2024-05-06 17:19:11 +02:00
|
|
|
public String changeStringFormat(String string, String formatation){
|
2024-04-29 21:06:04 +02:00
|
|
|
String ANSI_RESET = "\u001B[0m";
|
|
|
|
|
2024-05-06 02:35:10 +02:00
|
|
|
return String.format(formatation + string + ANSI_RESET);
|
2024-04-29 21:06:04 +02:00
|
|
|
}
|
|
|
|
|
2024-04-29 21:17:51 +02:00
|
|
|
|
2024-04-29 21:06:04 +02:00
|
|
|
private String colorPicker(int playerNumber){
|
|
|
|
if (playerNumber == 1){
|
|
|
|
return "\u001B[35m"; // Quelle 2
|
|
|
|
}
|
|
|
|
|
|
|
|
Random rand = new Random(); // Quelle 1 Anfang
|
|
|
|
int randomIndex = rand.nextInt(playerColors.size()); //
|
|
|
|
return playerColors.remove(randomIndex); // Quelle 1 Ende
|
|
|
|
}
|
2024-04-30 12:46:42 +02:00
|
|
|
|
|
|
|
|
2024-05-06 02:35:10 +02:00
|
|
|
public Player getCurrentPlayer(){
|
|
|
|
return game.getCurrentPlayer();
|
2024-05-04 21:06:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void nextPlayer(){
|
|
|
|
game.nextTurn();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-05-06 02:35:10 +02:00
|
|
|
public void creteDevPlayers(int amountPlayer){
|
2024-05-04 21:06:05 +02:00
|
|
|
String[] names = {"Vic", "Nastja", "Lilli", "Emelie", "Esra", "Oli"};
|
2024-04-30 12:46:42 +02:00
|
|
|
for (int i = 0; i < amountPlayer; i++){
|
|
|
|
addPlayer(i+1, names[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-05-04 21:06:05 +02:00
|
|
|
public ArrayList<Integer> rollDices(ArrayList<Integer> rolls, String keptDice){
|
2024-05-05 18:12:50 +02:00
|
|
|
//? DEV TEST
|
|
|
|
if (keptDice.startsWith("dev")){
|
|
|
|
return createDevRoll(keptDice);
|
|
|
|
}
|
|
|
|
|
2024-05-04 21:06:05 +02:00
|
|
|
ArrayList<Integer> oldRolls = extractKeptDice(rolls, keptDice);
|
|
|
|
|
|
|
|
int amountNewRolls = oldRolls.size();
|
|
|
|
ArrayList<Integer> newRolls = rollMultipleDice(5 - amountNewRolls);
|
|
|
|
|
|
|
|
oldRolls.addAll(newRolls);
|
|
|
|
|
|
|
|
return oldRolls;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private ArrayList<Integer> extractKeptDice(ArrayList<Integer> previousRolls, String keptDice){
|
|
|
|
ArrayList<Integer> keptRolls = new ArrayList<Integer>();
|
|
|
|
|
|
|
|
if (keptDice.isEmpty()){
|
|
|
|
return keptRolls;
|
|
|
|
}
|
|
|
|
|
2024-05-05 18:12:50 +02:00
|
|
|
//? Remove whitespaces
|
|
|
|
keptDice = keptDice.replaceAll("\\s+","");
|
|
|
|
|
2024-05-04 21:06:05 +02:00
|
|
|
if (keptDice.length() == 1){
|
|
|
|
int singleIndex = Integer.parseInt(keptDice);
|
|
|
|
keptRolls.add(previousRolls.get(singleIndex - 1));
|
|
|
|
return keptRolls;
|
|
|
|
}
|
|
|
|
|
|
|
|
keptDice = keptDice.substring(1, keptDice.length()-1);
|
|
|
|
|
|
|
|
String[] keptDiceIndicesStrings = keptDice.split(",");
|
|
|
|
|
|
|
|
for (String keptDiceIndicesString : keptDiceIndicesStrings) {
|
|
|
|
int index = Integer.parseInt(keptDiceIndicesString);
|
|
|
|
keptRolls.add(previousRolls.get(index - 1));
|
|
|
|
}
|
|
|
|
|
|
|
|
return keptRolls;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private ArrayList<Integer> rollMultipleDice(int amountRolls){
|
|
|
|
ArrayList<Integer> rolls = new ArrayList<>();
|
|
|
|
if (amountRolls == 0){
|
|
|
|
return rolls;
|
|
|
|
}
|
|
|
|
|
2024-04-30 12:46:42 +02:00
|
|
|
for (int i = 0; i < amountRolls; i++){
|
2024-05-04 21:06:05 +02:00
|
|
|
rolls.add(game.rollDice());
|
2024-04-30 12:46:42 +02:00
|
|
|
}
|
2024-05-04 21:06:05 +02:00
|
|
|
return rolls;
|
2024-04-30 12:46:42 +02:00
|
|
|
}
|
|
|
|
|
2024-05-04 21:06:05 +02:00
|
|
|
|
2024-05-06 02:35:10 +02:00
|
|
|
public String evaluateRoll(ArrayList<Integer> rolls){
|
|
|
|
HashMap<String, Category> possibleCombinations = createCategoryHashMap();
|
2024-05-06 17:19:11 +02:00
|
|
|
ArrayList<Category> validUpperCombinations = new ArrayList<>();
|
|
|
|
allValidCombinations = new ArrayList<>();
|
2024-05-06 02:35:10 +02:00
|
|
|
//TODO Add starwars logic
|
|
|
|
|
|
|
|
|
|
|
|
for (int dice : rolls){
|
|
|
|
switch (dice){
|
|
|
|
case 1:
|
|
|
|
possibleCombinations.get("Aces").addAmount();
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
possibleCombinations.get("Twos").addAmount();
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
possibleCombinations.get("Threes").addAmount();
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
possibleCombinations.get("Fours").addAmount();
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
possibleCombinations.get("Fives").addAmount();
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
possibleCombinations.get("Sixes").addAmount();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
sb.append(String.format("%s \n", changeStringFormat("Possible combinations:", "\u001B[32m")));
|
|
|
|
sb.append(String.format("%s \n", changeStringFormat("Upper half:", "\u001b[4m")));
|
|
|
|
|
2024-05-06 17:19:11 +02:00
|
|
|
|
|
|
|
for (String key : possibleCombinations.keySet()) {
|
2024-05-06 02:35:10 +02:00
|
|
|
Category keyObj = possibleCombinations.get(key);
|
|
|
|
|
2024-05-06 17:19:11 +02:00
|
|
|
if (keyObj.getAmount() != 0){
|
|
|
|
validUpperCombinations.add(keyObj);
|
|
|
|
addCombinationToStringbuilder(sb, keyObj, allValidCombinations);
|
2024-05-06 02:35:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//? ------------------------------ LOWER HALF-------------------------------------------------
|
|
|
|
sb.append("\n");
|
|
|
|
sb.append(String.format("%s \n", changeStringFormat("Lower half:", "\u001b[4m")));
|
|
|
|
|
|
|
|
int index = 0;
|
|
|
|
Category keyObj;
|
2024-05-06 17:19:11 +02:00
|
|
|
for(Category category : validUpperCombinations){
|
2024-05-06 02:35:10 +02:00
|
|
|
|
|
|
|
//? Three of a kind
|
|
|
|
if (category.getAmount() >= 3){
|
|
|
|
keyObj = possibleCombinations.get("ThreeOfKind");
|
|
|
|
|
|
|
|
keyObj.calcValueFromRoll(rolls);
|
2024-05-06 17:19:11 +02:00
|
|
|
addCombinationToStringbuilder(sb, keyObj, allValidCombinations);
|
2024-05-06 02:35:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//? Four of a kind
|
|
|
|
if (category.getAmount() >= 4){
|
|
|
|
keyObj = possibleCombinations.get("FourOfKind");
|
|
|
|
|
|
|
|
keyObj.calcValueFromRoll(rolls);
|
2024-05-06 17:19:11 +02:00
|
|
|
addCombinationToStringbuilder(sb, keyObj, allValidCombinations);
|
2024-05-06 02:35:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//? Full House
|
|
|
|
if (category.getAmount() == 3){
|
2024-05-06 17:19:11 +02:00
|
|
|
for(Category innerCategory : validUpperCombinations){
|
2024-05-06 02:35:10 +02:00
|
|
|
if ((innerCategory.getAmount() == 2) && !(innerCategory.toString().equals(category.toString()))){
|
|
|
|
keyObj = possibleCombinations.get("FullHouse");
|
|
|
|
|
|
|
|
keyObj.independentValue();
|
2024-05-06 17:19:11 +02:00
|
|
|
addCombinationToStringbuilder(sb, keyObj, allValidCombinations);
|
2024-05-06 02:35:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-06 17:19:11 +02:00
|
|
|
ArrayList<Integer> sortedRolls = new ArrayList<>(rolls);
|
|
|
|
Collections.sort(sortedRolls);
|
2024-05-06 02:35:10 +02:00
|
|
|
|
|
|
|
|
2024-05-06 17:19:11 +02:00
|
|
|
//? Small Straight
|
|
|
|
if (index == 0) {
|
|
|
|
checkForSmallStraight(sortedRolls, possibleCombinations, sb);
|
|
|
|
}
|
2024-05-06 02:35:10 +02:00
|
|
|
|
|
|
|
//? Large Straight
|
|
|
|
if (index == 0){
|
2024-05-06 17:19:11 +02:00
|
|
|
checkForLargeStraight(sortedRolls, index, possibleCombinations, sb);
|
2024-05-06 02:35:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//? Yahtzee
|
|
|
|
if (category.getAmount() == 5){
|
|
|
|
keyObj = possibleCombinations.get("Yahtzee");
|
|
|
|
|
|
|
|
keyObj.independentValue();
|
2024-05-06 17:19:11 +02:00
|
|
|
addCombinationToStringbuilder(sb, keyObj, allValidCombinations);
|
2024-05-06 02:35:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
index ++;
|
|
|
|
}
|
|
|
|
|
|
|
|
keyObj = possibleCombinations.get("Chance");
|
|
|
|
|
|
|
|
keyObj.calcValueFromRoll(rolls);
|
2024-05-06 17:19:11 +02:00
|
|
|
addCombinationToStringbuilder(sb, keyObj, allValidCombinations);
|
|
|
|
|
|
|
|
return sb.toString();
|
|
|
|
}
|
|
|
|
|
2024-05-06 02:35:10 +02:00
|
|
|
|
2024-05-06 17:19:11 +02:00
|
|
|
private void checkForLargeStraight(ArrayList<Integer> sortedRolls, int index, HashMap<String, Category> possibleCombinations, StringBuilder sb) {
|
|
|
|
Category keyObj;
|
|
|
|
int amountRolls = sortedRolls.size();
|
2024-05-06 02:35:10 +02:00
|
|
|
|
2024-05-06 17:19:11 +02:00
|
|
|
if ((sortedRolls.get(index) + 1) == sortedRolls.get(index + 1)){
|
|
|
|
boolean isNotLargeStraight = false;
|
2024-05-06 02:35:10 +02:00
|
|
|
|
2024-05-06 17:19:11 +02:00
|
|
|
for (int i = 1; i < (amountRolls - 1); i++){
|
|
|
|
|
|
|
|
if ((sortedRolls.get(i) + 1) != sortedRolls.get(i + 1)){
|
|
|
|
isNotLargeStraight = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!(isNotLargeStraight)){
|
|
|
|
keyObj = possibleCombinations.get("LargeStraight");
|
|
|
|
|
|
|
|
keyObj.independentValue();
|
|
|
|
addCombinationToStringbuilder(sb, keyObj, allValidCombinations);
|
|
|
|
}
|
|
|
|
}
|
2024-05-06 02:35:10 +02:00
|
|
|
}
|
|
|
|
|
2024-05-06 17:19:11 +02:00
|
|
|
private void checkForSmallStraight(ArrayList<Integer> sortedRolls, HashMap<String, Category> possibleCombinations, StringBuilder sb) {
|
|
|
|
Category keyObj;
|
2024-05-06 02:35:10 +02:00
|
|
|
|
2024-05-06 17:19:11 +02:00
|
|
|
boolean isSmallStraight = false;
|
|
|
|
for (int i = 0; i < sortedRolls.size() - 3; i++) { // Quelle 3 Anfang
|
|
|
|
if (sortedRolls.get(i) + 1 == sortedRolls.get(i + 1) //
|
|
|
|
&& sortedRolls.get(i) + 2 == sortedRolls.get(i + 2) //
|
|
|
|
&& sortedRolls.get(i) + 3 == sortedRolls.get(i + 3)) //
|
|
|
|
{ // Quelle 3 Ende
|
|
|
|
isSmallStraight = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isSmallStraight) {
|
|
|
|
keyObj = possibleCombinations.get("SmallStraight");
|
|
|
|
|
|
|
|
keyObj.independentValue();
|
|
|
|
addCombinationToStringbuilder(sb, keyObj, allValidCombinations);
|
|
|
|
}
|
2024-05-06 02:35:10 +02:00
|
|
|
}
|
|
|
|
|
2024-05-06 17:19:11 +02:00
|
|
|
|
|
|
|
private void addCombinationToStringbuilder(StringBuilder sb, Category keyObj, ArrayList<Category> allValidCombinations){
|
2024-05-06 02:35:10 +02:00
|
|
|
int keyValue = keyObj.getValue();
|
|
|
|
String keyValueString = changeStringFormat(Integer.toString(keyValue), "\u001b[1m");
|
2024-05-06 17:19:11 +02:00
|
|
|
|
|
|
|
allValidCombinations.add(keyObj);
|
|
|
|
|
|
|
|
int keyAmount = keyObj.getAmount();
|
|
|
|
if (keyAmount == 0) {
|
|
|
|
sb.append(String.format("%s: Value: %s \n", keyObj, keyValueString));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
sb.append(String.format("%s: %d, Value: %s \n",keyObj, keyAmount, keyValueString));
|
2024-05-06 02:35:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void writeToSheet(String sheetInput){
|
2024-05-06 17:19:11 +02:00
|
|
|
HashMap<String, Category> possibleCombinations = createCategoryHashMap();
|
|
|
|
|
|
|
|
Sheet currentPlayerSheet = getCurrentPlayer().getSheet();
|
|
|
|
|
|
|
|
Category categoryToWrite = possibleCombinations.get(sheetInput);
|
|
|
|
|
|
|
|
|
|
|
|
boolean contains = false;
|
|
|
|
|
|
|
|
for (Category validCombination : allValidCombinations){
|
|
|
|
if(validCombination.toString().equals(categoryToWrite.toString())){
|
|
|
|
categoryToWrite = validCombination;
|
|
|
|
contains = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (contains){
|
2024-05-06 22:55:58 +02:00
|
|
|
if (getGamemode().equals("default")) {
|
|
|
|
currentPlayerSheet.writeCategory(categoryToWrite, false);
|
|
|
|
}else {
|
|
|
|
currentPlayerSheet.wr
|
|
|
|
}
|
2024-05-06 17:19:11 +02:00
|
|
|
}else {
|
|
|
|
currentPlayerSheet.writeCategory(categoryToWrite, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public ArrayList<String> getUnusedRows(){
|
|
|
|
Sheet currentPlayerSheet = getCurrentPlayer().getSheet();
|
|
|
|
return currentPlayerSheet.getUnusedRows();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public boolean checkGameEnd(){
|
|
|
|
return getCurrentPlayer().getSheet().checkGameEnd();
|
2024-05-06 02:35:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-05-06 22:55:58 +02:00
|
|
|
public String afterGame() throws IOException {
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
|
|
for (Player player : game.getPlayers()){
|
|
|
|
int score = player.getSheet().calcSheet();
|
|
|
|
player.setScore(score);
|
|
|
|
sb.append(String.format("%s scored %d points!", player.toString(), score));
|
|
|
|
writeToFile(createLeaderboardString(player));
|
|
|
|
}
|
|
|
|
|
|
|
|
return sb.toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private String createLeaderboardString(Player player){
|
|
|
|
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd.MM.yyy");
|
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
|
|
|
|
|
String date = dtf.format(now);
|
|
|
|
int score = player.getScore();
|
|
|
|
String name = player.getName();
|
|
|
|
|
|
|
|
return String.format("%d - %s - %s \n", score, name, date);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public ArrayList<String> readFromFile() throws FileNotFoundException {
|
|
|
|
ArrayList<String> leaderboardRows = new ArrayList<>();
|
|
|
|
Scanner fsc = null;
|
|
|
|
try {
|
|
|
|
fsc = new Scanner(new File(lederboardLocation));
|
|
|
|
} catch (FileNotFoundException e) {
|
|
|
|
System.out.println("There is an error opening the leaderboard.");
|
|
|
|
System.out.println("Returning to main menu \n");
|
|
|
|
return leaderboardRows;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (fsc.hasNextLine()){
|
|
|
|
leaderboardRows.add(fsc.nextLine());
|
|
|
|
}
|
|
|
|
return leaderboardRows;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void writeToFile(String stringToEnter) throws IOException {
|
|
|
|
|
|
|
|
if (stringToEnter.isEmpty()){
|
|
|
|
BufferedWriter writer = new BufferedWriter(new FileWriter(lederboardLocation));
|
|
|
|
writer.write("");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
System.out.printf("Not empty |%s| \n", stringToEnter);
|
|
|
|
|
|
|
|
ArrayList<String> currentRows = readFromFile();
|
|
|
|
|
|
|
|
currentRows.add(stringToEnter);
|
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
for(String leaderboardRow : currentRows) {
|
|
|
|
System.out.println(leaderboardRow);
|
|
|
|
String[] row = leaderboardRow.split(",");
|
|
|
|
System.out.printf("len row: %d \n", row.length);
|
|
|
|
sb.append(String.format("%s - %s - %s \n", row[1], row[0], row[2]));
|
|
|
|
}
|
|
|
|
|
|
|
|
BufferedWriter writer = new BufferedWriter(new FileWriter(lederboardLocation));
|
|
|
|
writer.write(sb.toString());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void clearLeaderboard() throws IOException {
|
|
|
|
writeToFile("");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-05-06 02:35:10 +02:00
|
|
|
private HashMap<String, Category> createCategoryHashMap(){
|
|
|
|
// TODO starwars sheet implementieren
|
|
|
|
Sheet sheet = new Sheet();
|
|
|
|
|
|
|
|
return sheet.getAllCategories();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-05-05 18:12:50 +02:00
|
|
|
private ArrayList<Integer> createDevRoll(String keptDice){
|
|
|
|
// Format: dev(1,2,3,4,5)
|
|
|
|
// values aren't indices, they are the dice value
|
|
|
|
ArrayList<Integer> devRoll = new ArrayList<>();
|
|
|
|
|
|
|
|
keptDice = keptDice.replaceAll("\\s+","");
|
|
|
|
keptDice = keptDice.substring(4, keptDice.length()-1);
|
|
|
|
|
|
|
|
String[] rollStrings = keptDice.split(",");
|
|
|
|
for (String rollString : rollStrings){
|
|
|
|
devRoll.add(Integer.parseInt(rollString));
|
|
|
|
}
|
|
|
|
return devRoll;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! TEST
|
2024-04-30 12:46:42 +02:00
|
|
|
public String[] getAllPlayerStrings(){
|
|
|
|
ArrayList<Player> players = game.getPlayers();
|
|
|
|
String[] returnStrings = new String[players.size()];
|
|
|
|
|
|
|
|
for (int i = 0; i < players.size(); i++){
|
|
|
|
returnStrings[i] = players.get(i).toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
return returnStrings;
|
|
|
|
}
|
2024-04-29 21:06:04 +02:00
|
|
|
}
|