Wolfram Language

Play RockPaperScissors Using SequencePredict

SequencePredict allows for the modeling of a sequence in order to predict its future evolution. In this example, SequencePredict is used to predict the next action of a rockpaperscissors player.

Record past sequences of an opponent.

Train a sequence predictor from these past sequences.

Use the predictor to predict an opponent's next action given their past actions.

Use the predictor to obtain probabilities about an opponent's next action.

Define a utility function for a move given an opponent's action.

Compute the expected utility for each action.

Assuming that this is the last round of the game, paper should be played here, and a win for the user is the most likely outcome.

Consider another probability vector for your opponent.

This time rock should be played, and the most likely outcome is a draw.

Related Examples

de es fr ja pt-br zh