diff --git a/H5_Skunk/bin/Dice.class b/H5_Skunk/bin/Dice.class index 060166c..7b06082 100644 Binary files a/H5_Skunk/bin/Dice.class and b/H5_Skunk/bin/Dice.class differ diff --git a/H5_Skunk/bin/SkunkApp.class b/H5_Skunk/bin/SkunkApp.class index 3f03f75..e41bed6 100644 Binary files a/H5_Skunk/bin/SkunkApp.class and b/H5_Skunk/bin/SkunkApp.class differ diff --git a/H5_Skunk/bin/SkunkDomain.class b/H5_Skunk/bin/SkunkDomain.class index aafa96a..b4e5b18 100644 Binary files a/H5_Skunk/bin/SkunkDomain.class and b/H5_Skunk/bin/SkunkDomain.class differ diff --git a/H5_Skunk/src/Dice.java b/H5_Skunk/src/Dice.java index ec50a7d..bce0448 100644 --- a/H5_Skunk/src/Dice.java +++ b/H5_Skunk/src/Dice.java @@ -68,11 +68,21 @@ public Die getDie1() // TODO Auto-generated method stub return this.die1; } + + public int getDie1LastRoll() + { + return this.die1.getLastRoll(); + } public Die getDie2() { return this.die2; } + + public int getDie2LastRoll() + { + return this.die2.getLastRoll(); + } public void setDie1(Die d) { diff --git a/H5_Skunk/src/SkunkApp.java b/H5_Skunk/src/SkunkApp.java index feb4554..f071e07 100644 --- a/H5_Skunk/src/SkunkApp.java +++ b/H5_Skunk/src/SkunkApp.java @@ -4,6 +4,7 @@ public class SkunkApp public SkunkDomain skunkDomain; public int numberOfPlayers; public String[] playerNames; + private int playNamesLength = 20; public SkunkApp() { @@ -11,7 +12,8 @@ public SkunkApp() skunkDomain = new SkunkDomain(skunkUI); skunkUI.setDomain(skunkDomain); this.numberOfPlayers = 0; - this.playerNames = new String[20]; + //this.playerNames = new String[20]; + this.playerNames = new String[playNamesLength]; } diff --git a/H5_Skunk/src/SkunkDomain.java b/H5_Skunk/src/SkunkDomain.java index b0f325c..2ec1a2e 100644 --- a/H5_Skunk/src/SkunkDomain.java +++ b/H5_Skunk/src/SkunkDomain.java @@ -29,6 +29,16 @@ public SkunkDomain(SkunkUI ui) this.wantsToQuit = false; this.oneMoreRoll = false; } + + public void twoSkunks() + { + ui.println("Two Skunks! You lose the turn, the round score, plus pay 4 chips to the kitty"); + kitty += 4; + activePlayer.setNumberChips(activePlayer.getNumberChips() - 4); + activePlayer.setTurnScore(0); + activePlayer.setRoundScore(0); + + } public boolean run() { @@ -48,6 +58,8 @@ public boolean run() ui.println("Starting game...\n"); boolean gameNotOver = true; + + while (gameNotOver) { @@ -61,11 +73,7 @@ public boolean run() skunkDice.roll(); if (skunkDice.getLastRoll() == 2) { - ui.println("Two Skunks! You lose the turn, the round score, plus pay 4 chips to the kitty"); - kitty += 4; - activePlayer.setNumberChips(activePlayer.getNumberChips() - 4); - activePlayer.setTurnScore(0); - activePlayer.setRoundScore(0); + twoSkunks(); wantsToRoll = false; break; } @@ -78,7 +86,7 @@ else if (skunkDice.getLastRoll() == 3) wantsToRoll = false; break; } - else if (skunkDice.getDie1().getLastRoll() == 1 || skunkDice.getDie2().getLastRoll() == 1) + else if (skunkDice.getDie1LastRoll() == 1 || skunkDice.getDie2LastRoll() == 1) { ui.println("One Skunk! You lose the turn, the turn score, plus pay 1 chip to the kitty"); kitty += 1;