diff --git a/bin/domain/Hand.class b/bin/domain/Hand.class index df89118..0ec25ba 100644 Binary files a/bin/domain/Hand.class and b/bin/domain/Hand.class differ diff --git a/bin/domain/Player.class b/bin/domain/Player.class index b042281..ced4701 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 new file mode 100644 index 0000000..afacad4 Binary files /dev/null and b/bin/facade/YahtzeeGame.class differ diff --git a/src/domain/Hand.java b/src/domain/Hand.java index c7843fe..89fa2d4 100644 --- a/src/domain/Hand.java +++ b/src/domain/Hand.java @@ -20,7 +20,7 @@ public class Hand { } } - public void lockInDice(int dice) { + private void lockInDice(int dice) { for (int i = 0; i < this.dices.size(); i++) { diff --git a/src/domain/Player.java b/src/domain/Player.java index 8d3603f..b23f4b9 100644 --- a/src/domain/Player.java +++ b/src/domain/Player.java @@ -1,11 +1,13 @@ package domain; +import java.time.LocalDate; + public class Player { - private String name; - private Hand hand; - private Box box; - private String savedGamemode; + String name; + Hand hand; + Box box; + String savedGamemode; public Player(String name, String gamemode) { @@ -21,4 +23,13 @@ public class Player { this.hand = new Hand(this.savedGamemode); } + + 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 new file mode 100644 index 0000000..f3b32b5 --- /dev/null +++ b/src/facade/YahtzeeGame.java @@ -0,0 +1,26 @@ +package facade; + +import java.util.ArrayList; + +import domain.Player; + +public class YahtzeeGame { + + public int playerCount; + public ArrayList players = new ArrayList<>(); + public String savedGamemode; + public String gameSheet; + + public YahtzeeGame(int playerCount, String gamemode, String... names) { + + this.playerCount = playerCount; + this.savedGamemode = gamemode; + + for (int i = 0; i < this.playerCount; i++) { + + this.players.add(new Player(names[i], this.savedGamemode)); + + } + } + +}