|
|
|
@ -14,7 +14,6 @@ fun HandHistory.addAction(street: Street, position: Int, type: Action.Type, effe |
|
|
|
action.street = street |
|
|
|
action.street = street |
|
|
|
action.position = position |
|
|
|
action.position = position |
|
|
|
action.type = type |
|
|
|
action.type = type |
|
|
|
// action.amount = amount |
|
|
|
|
|
|
|
action.effectiveAmount = effectiveAmount |
|
|
|
action.effectiveAmount = effectiveAmount |
|
|
|
action.index = this.actions.size |
|
|
|
action.index = this.actions.size |
|
|
|
this.actions.add(action) |
|
|
|
this.actions.add(action) |
|
|
|
@ -159,4 +158,40 @@ class HandHistoryTest { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
fun potTest5() { // A multi allin pot |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val hh = handHistoryInstance(5) // 3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hh.addAction(Street.PREFLOP, 0, Action.Type.BET_ALLIN, 1999.0) |
|
|
|
|
|
|
|
hh.addAction(Street.PREFLOP, 1, Action.Type.CALL, 1998.0) |
|
|
|
|
|
|
|
hh.addAction(Street.PREFLOP, 2, Action.Type.CALL_ALLIN, 1000.0) // 5000 |
|
|
|
|
|
|
|
hh.addAction(Street.PREFLOP, 3, Action.Type.CALL_ALLIN, 500.0) // 5500 |
|
|
|
|
|
|
|
hh.addAction(Street.PREFLOP, 4, Action.Type.RAISE_ALLIN, 4000.0) |
|
|
|
|
|
|
|
hh.addAction(Street.PREFLOP, 1, Action.Type.CALL, 2000.0) // 11500 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val ps0 = playerSetupInstance(0, listOf(card(14, 3), card(2, 1))) |
|
|
|
|
|
|
|
val ps1 = playerSetupInstance(1, listOf(card(13, 3), card(3, 1))) |
|
|
|
|
|
|
|
val ps2 = playerSetupInstance(2, listOf(card(11, 3), card(4, 1))) |
|
|
|
|
|
|
|
val ps3 = playerSetupInstance(3, listOf(card(10, 3), card(5, 1))) |
|
|
|
|
|
|
|
val ps4 = playerSetupInstance(4, listOf(card(8, 3), card(6, 1))) |
|
|
|
|
|
|
|
hh.playerSetups.addAll(listOf(ps0, ps1, ps2, ps3, ps4)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hh.board.addAll(board(listOf(4, 5, 6, 7, 9), listOf(3, 3, 3, 3, 3))) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// hh.defineWinnerPositions() |
|
|
|
|
|
|
|
val pots = hh.getPots(hh.positionIndexes.toList()) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Assert.assertEquals(4, pots.size) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val mainPot = pots.any { it.amount == 2500.0 } |
|
|
|
|
|
|
|
Assert.assertEquals(true, mainPot) |
|
|
|
|
|
|
|
val pot1 = pots.any { it.amount == 2000.0 } |
|
|
|
|
|
|
|
Assert.assertEquals(true, pot1) |
|
|
|
|
|
|
|
val pot2 = pots.any { it.amount == 3000.0 } |
|
|
|
|
|
|
|
Assert.assertEquals(true, pot2) |
|
|
|
|
|
|
|
val pot3 = pots.any { it.amount == 4000.0 } |
|
|
|
|
|
|
|
Assert.assertEquals(true, pot3) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |