[opentestbed] push by bluegaspode - fixed issue#29 on 2010-11-14 22:52 GMT

1 view
Skip to first unread message

opent...@googlecode.com

unread,
Nov 14, 2010, 5:53:57 PM11/14/10
to opent...@googlegroups.com
Revision: abc30a54f8
Author: bluegaspode
Date: Sun Nov 14 14:52:37 2010
Log: fixed issue#29
http://code.google.com/p/opentestbed/source/detail?r=abc30a54f8

Modified:
/junit/game/PublicGameInfoTest.java
/src/game/PublicGameInfo.java

=======================================
--- /junit/game/PublicGameInfoTest.java Thu Jun 24 00:38:31 2010
+++ /junit/game/PublicGameInfoTest.java Sun Nov 14 14:52:37 2010
@@ -255,4 +255,31 @@
assertEquals("minraise bigbet", 20, gameInfo.getMinRaise(), 0.001);
}

-}
+ /**
+ * Test the values of {@link PublicGameInfo#getNumRaises()}.
+ * According to issue #29, PokerAcademy also counts sb
+ * and bets as 'numRaise'.
+ * Also after each round numRaises starts at 0
+ */
+ @Test
+ public void testNumRaises() {
+ PublicGameInfo gameInfo = new PublicGameInfo();
+ gameInfo.setLimit(PublicGameInfo.NO_LIMIT);
+ gameInfo.setBlinds(5, 10);
+ gameInfo.setNumSeats(3);
+ gameInfo.setPlayer(0, PublicPlayerInfo.create("player0", 100, null));
+ gameInfo.setPlayer(1, PublicPlayerInfo.create("player1", 100, null));
+ gameInfo.setPlayer(2, PublicPlayerInfo.create("player2", 100, null));
+ gameInfo.newHand(0, 1, 2);
+
+ gameInfo.update(Action.smallBlindAction(5), 1);
+ assertEquals("sb counts as raise", 1, gameInfo.getNumRaises());
+ gameInfo.update(Action.bigBlindAction(10), 2);
+ assertEquals("bb no extra raise", 1, gameInfo.getNumRaises());
+ gameInfo.update(Action.callAction(10), 0);
+ gameInfo.nextStage(new Hand("7c 7s 7h"));
+ assertEquals("num raises = 0 after stage", 0, gameInfo.getNumRaises());
+ gameInfo.update(Action.betAction(10), 1);
+ assertEquals("bet is raise", 1, gameInfo.getNumRaises());
+ }
+}
=======================================
--- /src/game/PublicGameInfo.java Sun Nov 7 06:35:47 2010
+++ /src/game/PublicGameInfo.java Sun Nov 14 14:52:37 2010
@@ -572,6 +572,7 @@
}

this.lastAggressor = -1;
+ this.numRaises = 0;
getBoard().addHand(cardsToAddToBoard);
this.stage = nextStage(getStage());
this.minRaise = getInitialBetSize();
@@ -769,10 +770,8 @@
} else if (act.isBet()) {
potManager.addToPot(s, act.getAmount());
getPlayer(s).update(act);
- // Bet from BigBlind PreFlop is considered a raise
- if (stage == Holdem.PREFLOP && numRaises == 0 && s == bigBlindSeat) {
- numRaises++;
- }
+ // bet is considered a raise
+ numRaises++;

if (act.getAmount() > minRaise) {
minRaise = act.getAmount();
@@ -789,7 +788,7 @@
potManager.addToPot(s, act.getToCall());
getPlayer(s).update(act);
// if someone calls preflop, the bigblind gets a chance to act
- if (stage == Holdem.PREFLOP && lastToAct == smallBlindSeat && numRaises
== 0) {
+ if (stage == Holdem.PREFLOP && lastToAct == smallBlindSeat && numRaises
== 1) {
lastToAct = bigBlindSeat;
}

@@ -831,6 +830,7 @@
getPlayer(s).update(act);
this.toAct = bigBlindSeat;
this.lastAggressor = s;
+ numRaises++; // according to PA, after SB numRaises=1
} else {
throw new IllegalArgumentException("Invalid action, possibly
unimplemented");
}

Reply all
Reply to author
Forward
0 new messages