From 716c014b6813c9944fd4eb5bbac5e9c4db7039cf Mon Sep 17 00:00:00 2001 From: 13howardD Date: Sun, 26 Apr 2015 17:38:42 -0700 Subject: [PATCH] Changes to Game --- src/Game.java | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/Game.java b/src/Game.java index 4e2db48..c8c837e 100644 --- a/src/Game.java +++ b/src/Game.java @@ -34,26 +34,39 @@ public int numCards(){ public void playRound(){ if (d.hasNext() == true && t.numSets() == 0){ for (int i = 0; i < 3; i++){ - if (d.hasNext() == false) + if (d.hasNext()){ t.add(d.getNext()); } + else{ return; + } } + } - else if (d.hasNext() == true && t.numSets() != 0){ + if (d.hasNext() && t.numSets() != 0){ for (int x = 0; x < t.numCards() - 2; x++){ for (int y = x + 1; y < t.numCards() - 1; y++){ for (int z = y + 1; z < t.numCards(); z++){ if (t.getCard(x).isSet(t.getCard(y), t.getCard(z))){ t.removeSet(t.getCard(x), t.getCard(y), t.getCard(z)); - return; + + if (t.numCards() < 12 && d.hasNext()) { + for (int o = 0; o < 3; o++) { + if (d.hasNext()) { + t.add(d.getNext()); + } + else { + return; + } + } + } + return; } - } } - } - return; } - } + } + } + } public boolean isGameOver(){ if (d.hasNext() == false && t.numSets() == 0){