main
Jens 2024-05-06 16:33:54 +02:00
parent 5d731cc453
commit a7cf6f25be
3 changed files with 44 additions and 2 deletions

BIN
.DS_Store vendored 100644

Binary file not shown.

View File

@ -10,7 +10,6 @@ public class Game {
private int numberOfDice; private int numberOfDice;
private Dice dice = new Dice(numberOfDice); private Dice dice = new Dice(numberOfDice);
private int[] diceValues; private int[] diceValues;
private Player player1;
private Yatzy_Sheet sheet = new Yatzy_Sheet(); private Yatzy_Sheet sheet = new Yatzy_Sheet();
private Ones ones = new Ones(); private Ones ones = new Ones();
@ -30,11 +29,20 @@ public class Game {
public void startgame(int playerCount, String[] name, int numberOfDice){ public void startgame(int playerCount, String[] name, int numberOfDice){
for(int i = 0; i < playerCount; i++){ for(int i = 0; i < playerCount; i++){
player1 = new Player(name[i], sheet, dice); Player player1 = new Player(name[i], sheet, dice);
players.add(player1); players.add(player1);
} }
} }
// public void startgame(int playerCount, String[] name, int numberOfDice){
// this.numberOfDice = numberOfDice;
// dice = new Dice(numberOfDice);
// for(int i = 0; i < playerCount; i++){
// Player player = new Player(name[i], sheet, dice);
// players.add(player);
// }
// }
public int[] rollDice(Dice dice){ public int[] rollDice(Dice dice){
dice.rollDice(numberOfDice); dice.rollDice(numberOfDice);
int[] diceValues = dice.getValues(); int[] diceValues = dice.getValues();
@ -119,4 +127,24 @@ public class Game {
} }
return ""; return "";
} }
public String getCategoryNames(){
String[] categorynames = new String[13];
categorynames[0] = "Ones";
categorynames[1] = "Twos";
categorynames[2] = "Threes";
categorynames[3] = "Fours";
categorynames[4] = "Fives";
categorynames[5] = "Sixes";
categorynames[6] = "Two Pairs";
categorynames[7] = "Three Pairs";
categorynames[8] = "Four Pairs";
categorynames[9] = "Full House";
categorynames[10] = "Straight Flush";
categorynames[11] = "Royal Straight Flush";
categorynames[12] = "Yatzy";
return categorynames.toString();
}
} }

14
UI/Main.java 100644
View File

@ -0,0 +1,14 @@
package UI;
import Facade.Game;
public class Main {
public static void main(String[] args){
Game game = new Game();
String[] names = new String[2];
names[0] = "Jens";
names[1] = "mike";
game.startgame(2,names , 6);
System.out.println(game.getPlayerName(0));
}
}