Hello Philip Curran,
I understand that you want to write a MATLAB program that can simulate a poker game between two players. You were able to simulate the rounds, but you are facing an issue coming up with a logic that can represent all possible actions.
Since there are only a finite number of actions each player can take given a state, all the (state, action) pairs can be captured in the form of a state diagram. A MATLAB matrix can be used to define the state action pairs. An important thing to note here is that in poker, only the last state is relevant and not the entire history.
In the case of a poker game, we can consider the four basic moves:
Here is a sample list of (state, action) items when the first player “Raises/Bets”:
- (Raise, Raise) -> Prompt the first user to perform another action.
- (Raise, Call) -> Next Round.
- (Raise, Fold) -> End the game.
- (Raise, Check) is an invalid state.
Similarly, we can extend our matrix to other moves as well. The above example is provided to give you an idea on how the implementation could look like. Feel free to conceptualize the matrix according to your requirements.
Hope this helps!