Skip to content

The AI based on markov chain model predicts your next move based on your previous move. The AI gets better as you play more rounds (it learns your patterns as you play more rounds).

Notifications You must be signed in to change notification settings

iamvigneshwars/rock-paper-scissors-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 

Repository files navigation

rock-paper-scissors

This AI is built using Markov model. It predicts your next move and plays the move that counteracts your move. The prediction of your next move is only bases on your last move (markov property). The AI keeps track of three transition tables, WIN, LOSE and TIE. Each table records your moves based on your previous round result and previous move, i.e, if you have won the previous round, and your current move is rock, then the frequency of rockrock will be updated in WIN transition table. In simple terms this means you played rock in previous round, you won previous round and you chose to play rock as current move.

To make predictions, the AI can simply look up the transition tables based on your last move and last round result and return the probablities. If the predicted probablity for your next move is high for rock, then the AI plays paper, if the probablity is high for paper, then the the AI plays scissors, if the probablity is high go scissors, then the AI plays rock. Is is an active learning model, the AI gets better as you play more rounds with it. Give it a try, you will be amazed!

Demo

animated

Play the Game

About

The AI based on markov chain model predicts your next move based on your previous move. The AI gets better as you play more rounds (it learns your patterns as you play more rounds).

Topics

Resources

Stars

Watchers

Forks