Browse Source

You can no longer raise if all remaining oponents are all in

git-svn-id: http://chris.smith.name/svn/japoker/trunk@9 b8598caf-53df-4c1b-98b8-507a84a220
tags/v12
Chris Smith 16 years ago
parent
commit
c42a9c148c
1 changed files with 10 additions and 6 deletions
  1. 10
    6
      src/com/md87/cardgame/games/AbstractGame.java

+ 10
- 6
src/com/md87/cardgame/games/AbstractGame.java View File

@@ -1,5 +1,5 @@
1 1
 /*
2
- * Copyright (c) Chris 'MD87' Smith, 2007. All rights reserved.
2
+ * Copyright (c) Chris 'MD87' Smith, 2007-2008. All rights reserved.
3 3
  *
4 4
  * This code may not be redistributed without prior permission from the
5 5
  * aforementioned copyright holder(s).
@@ -34,8 +34,11 @@ public abstract class AbstractGame implements Game, Runnable {
34 34
     /** The maximum number of players this game will contain. */
35 35
     protected int numplayers = 0;
36 36
     
37
+    /** Size of the big blind. */
37 38
     protected int bigblind = 0;
39
+    /** Size of the ante. */
38 40
     protected int ante = 0;
41
+    /** Maximum number of raises. */
39 42
     protected int raises = 4;
40 43
     
41 44
     protected int raisesLeft;
@@ -71,9 +74,9 @@ public abstract class AbstractGame implements Game, Runnable {
71 74
             return;
72 75
         }
73 76
         
74
-        final Player player = new Player(this, name, cash, controller);
77
+        final Player myPlayer = new Player(this, name, cash, controller);
75 78
         
76
-        addPlayer(player);
79
+        addPlayer(myPlayer);
77 80
     }
78 81
     
79 82
     /** {@inheritDoc} */
@@ -101,8 +104,8 @@ public abstract class AbstractGame implements Game, Runnable {
101 104
     public int getCurrentPot() {
102 105
         int pot = 0;
103 106
         
104
-        for (Player player : players) {
105
-            pot += player.getBet();
107
+        for (Player myPlayer : players) {
108
+            pot += myPlayer.getBet();
106 109
         }
107 110
         
108 111
         return pot;
@@ -323,7 +326,8 @@ public abstract class AbstractGame implements Game, Runnable {
323 326
                         break;
324 327
                     }
325 328
                 } else {
326
-                    final boolean canRaise = raisesLeft != 0;
329
+                    final boolean canRaise = raisesLeft != 0
330
+                            && countPlayers(true, true, true) > 1;
327 331
                     
328 332
                     // He can call, raise or fold
329 333
                     switch (myPlayer.doCallRaiseFold(maxbet - myPlayer.getBet(), canRaise)) {

Loading…
Cancel
Save