File tree 1 file changed +20
-7
lines changed
1 file changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -34,26 +34,39 @@ public int numCards(){
34
34
public void playRound (){
35
35
if (d .hasNext () == true && t .numSets () == 0 ){
36
36
for (int i = 0 ; i < 3 ; i ++){
37
- if (d .hasNext () == false )
37
+ if (d .hasNext ()){
38
38
t .add (d .getNext ());
39
39
}
40
+ else {
40
41
return ;
42
+ }
41
43
}
44
+ }
42
45
43
- else if (d .hasNext () == true && t .numSets () != 0 ){
46
+ if (d .hasNext () && t .numSets () != 0 ){
44
47
for (int x = 0 ; x < t .numCards () - 2 ; x ++){
45
48
for (int y = x + 1 ; y < t .numCards () - 1 ; y ++){
46
49
for (int z = y + 1 ; z < t .numCards (); z ++){
47
50
if (t .getCard (x ).isSet (t .getCard (y ), t .getCard (z ))){
48
51
t .removeSet (t .getCard (x ), t .getCard (y ), t .getCard (z ));
49
- return ;
52
+
53
+ if (t .numCards () < 12 && d .hasNext ()) {
54
+ for (int o = 0 ; o < 3 ; o ++) {
55
+ if (d .hasNext ()) {
56
+ t .add (d .getNext ());
57
+ }
58
+ else {
59
+ return ;
60
+ }
61
+ }
62
+ }
63
+ return ;
50
64
}
51
- }
52
65
}
53
- }
54
- return ;
55
66
}
56
- }
67
+ }
68
+ }
69
+ }
57
70
58
71
public boolean isGameOver (){
59
72
if (d .hasNext () == false && t .numSets () == 0 ){
You can’t perform that action at this time.
0 commit comments