Improved lisibility

hh
Laurent 6 years ago
parent 6cee11edbe
commit 884ae51f3c
  1. 37
      app/src/main/java/net/pokeranalytics/android/model/handhistory/Builder.kt

@ -62,24 +62,25 @@ class Builder {
return if (lastSignificantAction != null) {
when (val actionType = lastSignificantAction.action.type) {
Action.Type.POST_BB, Action.Type.STRADDLE -> setOf(Action.Type.STRADDLE, Action.Type.FOLD, Action.Type.CALL, Action.Type.BET, Action.Type.BET_ALLIN)
Action.Type.BET, Action.Type.RAISE, Action.Type.RAISE_ALLIN, Action.Type.BET_ALLIN -> {
val remainingStack = lastUserAction?.playerRemainingStack
val actionAmount = lastSignificantAction.action.amount
val remainingStack = lastUserAction?.playerRemainingStack
val actionAmount = lastSignificantAction.action.amount
if ((actionType == Action.Type.RAISE_ALLIN || actionType == Action.Type.BET_ALLIN)
&& this.remainingPlayerCount == 2) {
if (remainingStack != null && actionAmount != null && remainingStack <= actionAmount) {
setOf(Action.Type.FOLD, Action.Type.CALL_ALLIN)
} else {
setOf(Action.Type.FOLD, Action.Type.CALL)
}
} else if (remainingStack != null && actionAmount != null && remainingStack <= actionAmount) {
when (lastSignificantAction.action.type) {
Action.Type.POST_BB, Action.Type.STRADDLE -> {
setOf(Action.Type.STRADDLE, Action.Type.FOLD, Action.Type.CALL, Action.Type.BET, Action.Type.BET_ALLIN)
}
Action.Type.BET, Action.Type.RAISE -> {
if (remainingStack != null && actionAmount != null && remainingStack <= actionAmount) {
setOf(Action.Type.FOLD, Action.Type.CALL_ALLIN)
} else {
setOf(Action.Type.FOLD, Action.Type.CALL, Action.Type.RAISE, Action.Type.RAISE_ALLIN)
}
}
Action.Type.RAISE_ALLIN, Action.Type.BET_ALLIN -> {
if (remainingStack != null && actionAmount != null && remainingStack <= actionAmount) {
setOf(Action.Type.FOLD, Action.Type.CALL_ALLIN)
} else if (this.remainingPlayerCount == 2 && remainingStack != null && actionAmount != null && remainingStack > actionAmount) {
setOf(Action.Type.FOLD, Action.Type.CALL)
} else {
setOf(Action.Type.FOLD, Action.Type.CALL, Action.Type.RAISE, Action.Type.RAISE_ALLIN)
}
@ -104,6 +105,10 @@ class Builder {
// remove everything after
}
private fun setAmount(index: Int, amount: Double) {
}
private fun getLastUserAction(index: Int): ComputedAction? {
val computedAction = this.sortedActions.first { it.action.index == index }
val action = computedAction.action

Loading…
Cancel
Save