|
|
|
@ -17,6 +17,7 @@ interface ActionManager { |
|
|
|
fun allinAmountSet(positionIndex: Int) |
|
|
|
fun allinAmountSet(positionIndex: Int) |
|
|
|
fun blindsUpdated(type: Action.Type, amount: Double) |
|
|
|
fun blindsUpdated(type: Action.Type, amount: Double) |
|
|
|
fun minimumBetAmount(index: Int): Double |
|
|
|
fun minimumBetAmount(index: Int): Double |
|
|
|
|
|
|
|
fun totalPotSize(index: Int): Double |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
interface ActionListListener : PlayerSetupCreationListener { |
|
|
|
interface ActionListListener : PlayerSetupCreationListener { |
|
|
|
@ -170,7 +171,7 @@ class ActionList(var listener: ActionListListener) : ArrayList<ComputedAction>() |
|
|
|
val lastSignificantAction: ComputedAction? = getStreetLastSignificantAction(computedAction.street, index - 1) |
|
|
|
val lastSignificantAction: ComputedAction? = getStreetLastSignificantAction(computedAction.street, index - 1) |
|
|
|
|
|
|
|
|
|
|
|
return if (lastSignificantAction == null) { |
|
|
|
return if (lastSignificantAction == null) { |
|
|
|
setOf(Action.Type.FOLD, Action.Type.CHECK, Action.Type.BET, Action.Type.UNDEFINED_ALLIN) |
|
|
|
setOf(Action.Type.FOLD, Action.Type.CHECK, Action.Type.BET, Action.Type.POT, Action.Type.UNDEFINED_ALLIN) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
val remainingStack = getLastPlayerAction(index)?.playerRemainingStack |
|
|
|
val remainingStack = getLastPlayerAction(index)?.playerRemainingStack |
|
|
|
val actionAmount = lastSignificantAction.action.amount |
|
|
|
val actionAmount = lastSignificantAction.action.amount |
|
|
|
@ -178,16 +179,16 @@ class ActionList(var listener: ActionListListener) : ArrayList<ComputedAction>() |
|
|
|
when (lastSignificantAction.action.type) { |
|
|
|
when (lastSignificantAction.action.type) { |
|
|
|
Action.Type.POST_SB, Action.Type.POST_BB, Action.Type.STRADDLE -> { |
|
|
|
Action.Type.POST_SB, Action.Type.POST_BB, Action.Type.STRADDLE -> { |
|
|
|
if (position == lastSignificantAction.position) { |
|
|
|
if (position == lastSignificantAction.position) { |
|
|
|
setOf(Action.Type.FOLD, Action.Type.CHECK, Action.Type.BET, Action.Type.UNDEFINED_ALLIN) |
|
|
|
setOf(Action.Type.FOLD, Action.Type.CHECK, Action.Type.BET, Action.Type.POT, Action.Type.UNDEFINED_ALLIN) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
setOf(Action.Type.FOLD, Action.Type.CALL, Action.Type.BET, Action.Type.UNDEFINED_ALLIN) |
|
|
|
setOf(Action.Type.FOLD, Action.Type.CALL, Action.Type.BET, Action.Type.POT, Action.Type.UNDEFINED_ALLIN) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
Action.Type.BET, Action.Type.RAISE -> { |
|
|
|
Action.Type.BET, Action.Type.POT, Action.Type.RAISE -> { |
|
|
|
if (remainingStack != null && actionAmount != null && remainingStack <= actionAmount) { |
|
|
|
if (remainingStack != null && actionAmount != null && remainingStack <= actionAmount) { |
|
|
|
setOf(Action.Type.FOLD, Action.Type.CALL_ALLIN) |
|
|
|
setOf(Action.Type.FOLD, Action.Type.CALL_ALLIN) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
setOf(Action.Type.FOLD, Action.Type.CALL, Action.Type.RAISE, Action.Type.UNDEFINED_ALLIN) |
|
|
|
setOf(Action.Type.FOLD, Action.Type.CALL, Action.Type.POT, Action.Type.RAISE, Action.Type.UNDEFINED_ALLIN) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
Action.Type.RAISE_ALLIN, Action.Type.BET_ALLIN -> { |
|
|
|
Action.Type.RAISE_ALLIN, Action.Type.BET_ALLIN -> { |
|
|
|
@ -196,11 +197,11 @@ class ActionList(var listener: ActionListListener) : ArrayList<ComputedAction>() |
|
|
|
} else if (activePositions(index).size == 2 && remainingStack != null && actionAmount != null && remainingStack > actionAmount) { |
|
|
|
} else if (activePositions(index).size == 2 && remainingStack != null && actionAmount != null && remainingStack > actionAmount) { |
|
|
|
setOf(Action.Type.FOLD, Action.Type.CALL) |
|
|
|
setOf(Action.Type.FOLD, Action.Type.CALL) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
setOf(Action.Type.FOLD, Action.Type.CALL, Action.Type.RAISE, Action.Type.UNDEFINED_ALLIN) |
|
|
|
setOf(Action.Type.FOLD, Action.Type.CALL, Action.Type.POT, Action.Type.RAISE, Action.Type.UNDEFINED_ALLIN) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else -> { |
|
|
|
else -> { |
|
|
|
throw PAIllegalStateException("We should not handle this action: ${lastSignificantAction.action.type}") |
|
|
|
throw PAIllegalStateException("We do not handle this action: ${lastSignificantAction.action.type}") |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -551,6 +552,10 @@ class ActionList(var listener: ActionListListener) : ArrayList<ComputedAction>() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun totalPotSize(index: Int): Double { |
|
|
|
|
|
|
|
return this.handHistory.anteSum + this.take(index).sumByDouble { it.action.effectiveAmount } |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
/*** |
|
|
|
* Returns the next significant player action in the street, if any, for the action at the provided [index] |
|
|
|
* Returns the next significant player action in the street, if any, for the action at the provided [index] |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|