From 6cee11edbe591235dce784009b3db550413f4f85 Mon Sep 17 00:00:00 2001 From: Laurent Date: Thu, 9 Jan 2020 17:26:40 +0100 Subject: [PATCH] Manage forgotten case to determine possible HH player action --- .../android/model/handhistory/Builder.kt | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/net/pokeranalytics/android/model/handhistory/Builder.kt b/app/src/main/java/net/pokeranalytics/android/model/handhistory/Builder.kt index ca2f941e..338a58ff 100644 --- a/app/src/main/java/net/pokeranalytics/android/model/handhistory/Builder.kt +++ b/app/src/main/java/net/pokeranalytics/android/model/handhistory/Builder.kt @@ -62,14 +62,23 @@ class Builder { return if (lastSignificantAction != null) { - when (lastSignificantAction.action.type) { + 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 - if (remainingStack != null && actionAmount != null && remainingStack <= actionAmount) { + 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) { setOf(Action.Type.FOLD, Action.Type.CALL_ALLIN) } else { setOf(Action.Type.FOLD, Action.Type.CALL, Action.Type.RAISE, Action.Type.RAISE_ALLIN) @@ -86,6 +95,11 @@ class Builder { } + private val remainingPlayerCount: Int + get() { + return 0 // TODO + } + private fun selectAction(index: Int, actionType: Action.Type) { // remove everything after }