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

Loading…
Cancel
Save