|
|
|
|
@ -117,7 +117,8 @@ class ActionList(var listener: ActionListListener? = null) : ArrayList<ComputedA |
|
|
|
|
type = if (significant != null) { |
|
|
|
|
val betAmount = significant.action.amount |
|
|
|
|
val remainingStack = computedAction.stackBeforeActing |
|
|
|
|
if (remainingStack != null && betAmount != null && remainingStack < betAmount) { |
|
|
|
|
val committedStack = getPreviouslyCommittedAmount(index) ?: 0.0 |
|
|
|
|
if (remainingStack != null && betAmount != null && (committedStack + remainingStack < betAmount)) { |
|
|
|
|
Action.Type.CALL_ALLIN |
|
|
|
|
} else { |
|
|
|
|
Action.Type.RAISE_ALLIN |
|
|
|
|
@ -130,8 +131,10 @@ class ActionList(var listener: ActionListListener? = null) : ArrayList<ComputedA |
|
|
|
|
Action.Type.CALL -> { |
|
|
|
|
getStreetLastSignificantAction(computedAction.street, index - 1)?.let { |
|
|
|
|
val betAmount = it.action.amount ?: 0.0 |
|
|
|
|
|
|
|
|
|
val committedStack = getPreviouslyCommittedAmount(index) ?: 0.0 |
|
|
|
|
val remainingStack = computedAction.stackBeforeActing |
|
|
|
|
if (remainingStack != null && remainingStack < betAmount) { |
|
|
|
|
if (remainingStack != null && committedStack + remainingStack < betAmount) { |
|
|
|
|
type = Action.Type.CALL_ALLIN |
|
|
|
|
} |
|
|
|
|
} ?: throw PAIllegalStateException("Can't call without a significant action") |
|
|
|
|
@ -219,7 +222,8 @@ class ActionList(var listener: ActionListListener? = null) : ArrayList<ComputedA |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
Action.Type.BET, Action.Type.POT, Action.Type.RAISE -> { |
|
|
|
|
if (remainingStack != null && actionAmount != null && remainingStack <= actionAmount) { |
|
|
|
|
val committedStack = getPreviouslyCommittedAmount(index) ?: 0.0 |
|
|
|
|
if (remainingStack != null && actionAmount != null && committedStack + remainingStack <= actionAmount) { |
|
|
|
|
setOf(Action.Type.FOLD, Action.Type.CALL) |
|
|
|
|
} else { |
|
|
|
|
setOf(Action.Type.FOLD, Action.Type.CALL, Action.Type.POT, Action.Type.RAISE, Action.Type.UNDEFINED_ALLIN) |
|
|
|
|
@ -524,7 +528,8 @@ class ActionList(var listener: ActionListListener? = null) : ArrayList<ComputedA |
|
|
|
|
created = true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
val stack = this.filter { it.positionIndex == positionIndex }.sumByDouble { it.action.effectiveAmount } |
|
|
|
|
val stack = |
|
|
|
|
this.filter { it.positionIndex == positionIndex }.sumOf { it.action.effectiveAmount } |
|
|
|
|
playerSetup.stack = stack |
|
|
|
|
|
|
|
|
|
if (created) { |
|
|
|
|
@ -596,7 +601,7 @@ class ActionList(var listener: ActionListListener? = null) : ArrayList<ComputedA |
|
|
|
|
*/ |
|
|
|
|
override fun getStreetNextCalls(index: Int): List<ComputedAction> { |
|
|
|
|
val streetNextSignificantIndex = getStreetNextSignificantAction(index)?.action?.index |
|
|
|
|
?: this.lastIndexOfStreet(index) + 1 // +1 because of "until" |
|
|
|
|
?: (this.lastIndexOfStreet(index) + 1) // +1 because of "until" |
|
|
|
|
return this.filter { |
|
|
|
|
it.action.index in ((index + 1) until streetNextSignificantIndex) |
|
|
|
|
&& (it.action.type?.isCall ?: false) |
|
|
|
|
@ -610,7 +615,7 @@ class ActionList(var listener: ActionListListener? = null) : ArrayList<ComputedA |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun totalPotSize(index: Int): Double { |
|
|
|
|
return this.handHistory.anteSum + this.take(index).sumByDouble { it.action.effectiveAmount } |
|
|
|
|
return this.handHistory.anteSum + this.take(index).sumOf { it.action.effectiveAmount } |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
|