diff --git a/bin/domain/Box.class b/bin/domain/Box.class index 5365676..8ebf2b5 100644 Binary files a/bin/domain/Box.class and b/bin/domain/Box.class differ diff --git a/bin/domain/Player.class b/bin/domain/Player.class index ced4701..e97c803 100644 Binary files a/bin/domain/Player.class and b/bin/domain/Player.class differ diff --git a/bin/facade/YahtzeeGame.class b/bin/facade/YahtzeeGame.class index afacad4..ad2bd07 100644 Binary files a/bin/facade/YahtzeeGame.class and b/bin/facade/YahtzeeGame.class differ diff --git a/bin/ui/TUI.class b/bin/ui/TUI.class new file mode 100644 index 0000000..3727185 Binary files /dev/null and b/bin/ui/TUI.class differ diff --git a/src/domain/Box.java b/src/domain/Box.java index 280d65a..3e7afda 100644 --- a/src/domain/Box.java +++ b/src/domain/Box.java @@ -49,7 +49,7 @@ public class Box { this.savedGamemode = gamemode; } - public void evaluateUpperBoxOptions(ArrayList diceNumbers) { + private void evaluateUpperBoxOptions(ArrayList diceNumbers) { if (diceNumbers.contains(1)) for (int i = 0; i < diceNumbers.size(); i++) { @@ -93,7 +93,7 @@ public class Box { } } - public void evaluateLowerBoxOptions(ArrayList diceNumbers) { + private void evaluateLowerBoxOptions(ArrayList diceNumbers) { int sumOfAllNumbers = 0; for (int i = 0; i < diceNumbers.size(); i++) { diff --git a/src/domain/Player.java b/src/domain/Player.java index b23f4b9..96bfdac 100644 --- a/src/domain/Player.java +++ b/src/domain/Player.java @@ -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 ""; - - } } diff --git a/src/facade/YahtzeeGame.java b/src/facade/YahtzeeGame.java index f3b32b5..95ca70a 100644 --- a/src/facade/YahtzeeGame.java +++ b/src/facade/YahtzeeGame.java @@ -23,4 +23,68 @@ public class YahtzeeGame { } } + public void rollDices(int player) { + + players.get(player - 1).hand.rollDices(); + + } + + public ArrayList getAllDiceNumbers(int player) { + + return players.get(player - 1).hand.getAllDiceNumbers(); + + } + + public ArrayList getFreeDiceNumbers(int player) { + + return players.get(player - 1).hand.getFreeDiceNumbers(); + + } + + public ArrayList 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 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; + } } diff --git a/src/ui/TUI.java b/src/ui/TUI.java new file mode 100644 index 0000000..d9ecb19 --- /dev/null +++ b/src/ui/TUI.java @@ -0,0 +1,5 @@ +package ui; + +public class TUI { + +}