how to approach if statement or decision tree (that depend on previous actions stored, predicted)

Viewed 56

How to handle these decisions that depend on the previous actions ?

 actions_notreatament <- c("greenmass: raises 215 to 245 and is all-in\nRuslanchuk: folds \nfractool: folds \n", 
    "Ruslanchuk: folds \nfractool: calls 20\ngreenmass: raises 250 to 290 and is all-in\nfractool: folds \n", 
    "fractool: folds \ngreenmass: raises 290 to 330 and is all-in\nRuslanchuk: folds \n", 
    "greenmass: raises 330 to 370 and is all-in\nRuslanchuk: folds \nfractool: calls 330\n*** ", 
    "fractool: raises 965 to 1005 and is all-in\nRuslanchuk: folds \n", 
    "Ruslanchuk: calls 20\nfractool: checks \n*** ", "fractool: raises 965 to 1005 and is all-in\nRuslanchuk: folds \n"
    )

For better understand to solve this I have to clarify some things Every line was extracted with regex, everyline is a hand ID inside a tournament (that is what is called a poker hand history file .txt) there are 3 players every player sit on a place 1, 2, 3, and that seat does not change on that ID_tournament

all_names <- c("greenmass", "Ruslanchuk","fractool")

What changes is the position Button, Small Blind, Big Blind. I know the position of all players (all 2 or all 3, because the game start with 3, and there is only one winner at the end)

Button <- c("greenmass", "Ruslanchuk", "fractool", "greenmass", "fractool", 
"Ruslanchuk", "fractool")

SmallBlind <- c("Ruslanchuk", "fractool", "greenmass", "Ruslanchuk", "fractool", 
"Ruslanchuk", "fractool")

BigBlind <- c("fractool", "greenmass", "Ruslanchuk", "fractool", "Ruslanchuk", 
"fractool", "Ruslanchuk")

There is more data that is not relevant now, actions_notreatament[4] the player "greenmass" lost the tournament, so there is 2 players and the Button is also Small blind the order of act when there is 3 players is first the Button,Small blind and BigBlind.

I have make pseudocode that illustrates all iterations, but its quite large code and can't see a way to do this with automated tools or string

but I think I can do this with if

the Button can Fold, Call, Raise
the Small blind can Fold, Call, Raise 
the Big blind can Fold, check, call, raise. 

And so on until there is 2 folds or 2 calls, or 3 calls. So the player will go to the next stree (on poker this is called FLOP) or if there is 2 or 3 all-in they will see showdown.

0 Answers
Related