first facade commit
parent
0733927542
commit
8cadbcd55c
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -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++) {
|
||||
|
||||
|
|
|
@ -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 "";
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue