first facade commit

main
selim 2024-04-28 14:42:01 +02:00
parent 0733927542
commit 8cadbcd55c
6 changed files with 42 additions and 5 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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++) { for (int i = 0; i < this.dices.size(); i++) {

View File

@ -1,11 +1,13 @@
package domain; package domain;
import java.time.LocalDate;
public class Player { public class Player {
private String name; String name;
private Hand hand; Hand hand;
private Box box; Box box;
private String savedGamemode; String savedGamemode;
public Player(String name, String gamemode) { public Player(String name, String gamemode) {
@ -21,4 +23,13 @@ public class Player {
this.hand = new Hand(this.savedGamemode); this.hand = new Hand(this.savedGamemode);
} }
public String getHighscore() {
if (box.gameOver())
return "date: " + LocalDate.now().toString() + "\n" + name + ": " + box.returnTotalPoints();
else
return "";
}
} }

View File

@ -0,0 +1,26 @@
package facade;
import java.util.ArrayList;
import domain.Player;
public class YahtzeeGame {
public int playerCount;
public ArrayList<Player> 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));
}
}
}