iamvigneshwars / rock-paper-scissors-ai

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).

Home Page:https://iamvigneshwars.github.io/rock-paper-scissors-ai/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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).

https://iamvigneshwars.github.io/rock-paper-scissors-ai/


Languages

Language:JavaScript 59.6%Language:HTML 40.0%Language:CSS 0.4%