Parcourir la source

Fixed bootPlayer()

NedRedmond il y a 6 ans
Parent
révision
09c412575d
1 fichiers modifiés avec 7 ajouts et 4 suppressions
  1. 7
    4
      src/main/java/io/zipcoder/casino/Casino.java

+ 7
- 4
src/main/java/io/zipcoder/casino/Casino.java Voir le fichier

@@ -9,6 +9,9 @@ import io.zipcoder.casino.player.Players;
9 9
 import io.zipcoder.casino.utilities.Console;
10 10
 import io.zipcoder.casino.utilities.Game;
11 11
 
12
+import java.lang.reflect.Array;
13
+import java.util.Arrays;
14
+
12 15
 public class Casino {
13 16
     private Game game;
14 17
     Players players = Players.getInstance();
@@ -91,10 +94,10 @@ public class Casino {
91 94
 
92 95
     public void bootPlayer() {
93 96
         // If player balance is 0, player game over
94
-        for(Player player : players.getPlayers()) {
95
-          if(player.getChipBalance()<=0){
96
-            console.println(player.getName() + ", YOU ARE BROKE. GTFO, PEASANT.");
97
-            players.removePlayer(player);
97
+        for (int i = 0; i < players.getPlayers().size(); i++) {
98
+          if(players.getPlayers().get(i).getChipBalance()<=0){
99
+            console.println(players.getPlayers().get(i).getName() + ", YOU ARE BROKE. GTFO, PEASANT.");
100
+            players.removePlayer(players.getPlayers().get(i));
98 101
           }
99 102
         }
100 103
     }