facade and domain 3
parent
e2b89266b1
commit
5d731cc453
|
@ -1,12 +1,9 @@
|
|||
package Domain;
|
||||
|
||||
public class Fives extends Category{
|
||||
|
||||
private Player player;
|
||||
|
||||
public Fives(Player player) {
|
||||
public Fives() {
|
||||
super("Fives", "Score of all the fives rolled.");
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,7 +4,7 @@ public class FourPairs extends Category{
|
|||
|
||||
private int one = 0, two = 0, three = 0, four = 0, five = 0;
|
||||
|
||||
public FourPairs(Player player) {
|
||||
public FourPairs() {
|
||||
super("Four Pairs", "Four times the same dice");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
package Domain;
|
||||
|
||||
public class Fours extends Category{
|
||||
|
||||
private Player player;
|
||||
|
||||
public Fours(Player player) {
|
||||
public Fours() {
|
||||
super("Fours", "Score of all the fours rolled.");
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,7 +2,7 @@ package Domain;
|
|||
|
||||
public class FullHouse extends Category{
|
||||
|
||||
public FullHouse(Player player) {
|
||||
public FullHouse() {
|
||||
super("Full House", "1 Pair and 1 triplet");
|
||||
}
|
||||
|
||||
|
|
|
@ -2,11 +2,8 @@ package Domain;
|
|||
|
||||
public class Ones extends Category{
|
||||
|
||||
private Player player;
|
||||
|
||||
public Ones(Player player) {
|
||||
public Ones() {
|
||||
super("Ones", "Score of all the ones rolled.");
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,7 +2,7 @@ package Domain;
|
|||
|
||||
public class RoyalStraightFlush extends Category{
|
||||
|
||||
public RoyalStraightFlush(Player player) {
|
||||
public RoyalStraightFlush() {
|
||||
super("Royal Straight Flush", "1 - 5");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
package Domain;
|
||||
|
||||
public class Sixes extends Category{
|
||||
|
||||
private Player player;
|
||||
|
||||
public Sixes(Player player) {
|
||||
public Sixes() {
|
||||
super("Sixes", "Score of all the sixes rolled.");
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,7 +2,7 @@ package Domain;
|
|||
|
||||
public class StraightFlush extends Category{
|
||||
|
||||
public StraightFlush(Player player) {
|
||||
public StraightFlush() {
|
||||
super("Straight Flush", "1 - 4 or 2 - 5");
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ public class ThreePairs extends Category{
|
|||
|
||||
private int one = 0, two = 0, three = 0, four = 0, five = 0;
|
||||
|
||||
public ThreePairs(Player player) {
|
||||
public ThreePairs() {
|
||||
super("Three Pairs", "Three times the same dice");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
package Domain;
|
||||
|
||||
public class Threes extends Category{
|
||||
|
||||
private Player player;
|
||||
|
||||
public Threes(Player player) {
|
||||
public Threes() {
|
||||
super("Threes", "Score of all the threes rolled.");
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,7 +4,7 @@ public class TwoPairs extends Category{
|
|||
|
||||
private int one = 0, two = 0, three = 0, four = 0, five = 0;
|
||||
|
||||
public TwoPairs(Player player) {
|
||||
public TwoPairs() {
|
||||
super("Two Pairs", "Two times the same dice");
|
||||
}
|
||||
|
||||
|
|
|
@ -2,11 +2,8 @@ package Domain;
|
|||
|
||||
public class Twos extends Category{
|
||||
|
||||
private Player player;
|
||||
|
||||
public Twos(Player player) {
|
||||
public Twos() {
|
||||
super("Twos", "Score of all the twos rolled.");
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,7 +2,7 @@ package Domain;
|
|||
|
||||
public class Yatzy extends Category{
|
||||
|
||||
public Yatzy(Player player) {
|
||||
public Yatzy() {
|
||||
super("Yatzy", "five times the same dice");
|
||||
}
|
||||
|
||||
|
|
|
@ -13,19 +13,19 @@ public class Game {
|
|||
private Player player1;
|
||||
private Yatzy_Sheet sheet = new Yatzy_Sheet();
|
||||
|
||||
private Ones ones = new Ones(player1);
|
||||
private Twos twos = new Twos(player1);
|
||||
private Threes threes = new Threes(player1);
|
||||
private Fours fours = new Fours(player1);
|
||||
private Fives fives = new Fives(player1);
|
||||
private Sixes sixes = new Sixes(player1);
|
||||
private TwoPairs twoPairs = new TwoPairs(player1);
|
||||
private ThreePairs threePairs = new ThreePairs(player1);
|
||||
private FourPairs fourPairs = new FourPairs(player1);
|
||||
private FullHouse fullHouse = new FullHouse(player1);
|
||||
private StraightFlush straightFlush = new StraightFlush(player1);
|
||||
private RoyalStraightFlush royalStraightFlush = new RoyalStraightFlush(player1);
|
||||
private Yatzy yatzy = new Yatzy(player1);
|
||||
private Ones ones = new Ones();
|
||||
private Twos twos = new Twos();
|
||||
private Threes threes = new Threes();
|
||||
private Fours fours = new Fours();
|
||||
private Fives fives = new Fives();
|
||||
private Sixes sixes = new Sixes();
|
||||
private TwoPairs twoPairs = new TwoPairs();
|
||||
private ThreePairs threePairs = new ThreePairs();
|
||||
private FourPairs fourPairs = new FourPairs();
|
||||
private FullHouse fullHouse = new FullHouse();
|
||||
private StraightFlush straightFlush = new StraightFlush();
|
||||
private RoyalStraightFlush royalStraightFlush = new RoyalStraightFlush();
|
||||
private Yatzy yatzy = new Yatzy();
|
||||
|
||||
|
||||
public void startgame(int playerCount, String[] name, int numberOfDice){
|
||||
|
@ -45,55 +45,55 @@ public class Game {
|
|||
switch(category){
|
||||
case 1:
|
||||
ones.correctCategory(diceValues);
|
||||
sheet.addScore(0, ones.getScore());
|
||||
sheet.addScore(0, ones.getScore(diceValues));
|
||||
break;
|
||||
case 2:
|
||||
twos.correctCategory(diceValues);
|
||||
sheet.addScore(1, twos.getScore());
|
||||
sheet.addScore(1, twos.getScore(diceValues));
|
||||
break;
|
||||
case 3:
|
||||
threes.correctCategory(diceValues);
|
||||
sheet.addScore(2, threes.getScore());
|
||||
sheet.addScore(2, threes.getScore(diceValues));
|
||||
break;
|
||||
case 4:
|
||||
fours.correctCategory(diceValues);
|
||||
sheet.addScore(3, fours.getScore());
|
||||
sheet.addScore(3, fours.getScore(diceValues));
|
||||
break;
|
||||
case 5:
|
||||
fives.correctCategory(diceValues);
|
||||
sheet.addScore(4, fives.getScore());
|
||||
sheet.addScore(4, fives.getScore(diceValues));
|
||||
break;
|
||||
case 6:
|
||||
sixes.correctCategory(diceValues);
|
||||
sheet.addScore(5, sixes.getScore());
|
||||
sheet.addScore(5, sixes.getScore(diceValues));
|
||||
break;
|
||||
case 7:
|
||||
twoPairs.correctCategory(diceValues);
|
||||
sheet.addScore(6, twoPairs.getScore());
|
||||
sheet.addScore(6, twoPairs.getScore(diceValues));
|
||||
break;
|
||||
case 8:
|
||||
threePairs.correctCategory(diceValues);
|
||||
sheet.addScore(7, threePairs.getScore());
|
||||
sheet.addScore(7, threePairs.getScore(diceValues));
|
||||
break;
|
||||
case 9:
|
||||
fourPairs.correctCategory(diceValues);
|
||||
sheet.addScore(8, fourPairs.getScore());
|
||||
sheet.addScore(8, fourPairs.getScore(diceValues));
|
||||
break;
|
||||
case 10:
|
||||
fullHouse.correctCategory(diceValues);
|
||||
sheet.addScore(9, fullHouse.getScore());
|
||||
sheet.addScore(9, fullHouse.getScore(diceValues));
|
||||
break;
|
||||
case 11:
|
||||
straightFlush.correctCategory(diceValues);
|
||||
sheet.addScore(10, straightFlush.getScore());
|
||||
sheet.addScore(10, straightFlush.getScore(diceValues));
|
||||
break;
|
||||
case 12:
|
||||
royalStraightFlush.correctCategory(diceValues);
|
||||
sheet.addScore(11, royalStraightFlush.getScore());
|
||||
sheet.addScore(11, royalStraightFlush.getScore(diceValues));
|
||||
break;
|
||||
case 13:
|
||||
yatzy.correctCategory(diceValues);
|
||||
sheet.addScore(12, yatzy.getScore());
|
||||
sheet.addScore(12, yatzy.getScore(diceValues));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue