Skip to content
DRP edited this page Mar 2, 2019 · 3 revisions

Welcome to the MyRPS wiki!

Overview

A player plays against a computer many rounds of rock-paper-scissors. The score after many rounds are played is recorded and displayed.

Simple Machine Learning Algorithm Overview

  • Continuously record the last N choices between the human and the computer player.
    • Throw out the oldest choice in order to add a new one.
  • For example, suppose N = 5 and during the game, the recorded choices are (the human’s choices are every other choice, starting with first choice): PSRSP
    • The last choice was made by the human, and it was paper.
  • For each recorded sequence that ends with the human’s choice, the computer should store how many times that sequence has occurred (each sequence’s frequency).
    • For example, for N = 5, the stored sequences and their frequencies may be (in no particular order): RSPSR:1, SPRPP:3, RSPRS:2, RSPSS:4, RSPSP:3, SSRPP:2
  • Suppose the last four choices are RSPS.
    • In the last round, the human chose paper and the computer chose scissors.
  • The computer can predict that the human will most likely next choose scissors, since RSPSS appears more times than RSPSR and RSPSP in the stored frequencies.
    • Therefore, the computer should choose rock to beat the human’s predicted choice of scissors.

Implementation Extras

  • When a game ends, write the frequency data to a file, so that when a new game begins, these frequencies can be read back in.
  • As the computer plays more games and stores more frequency data, it becomes increasingly more capable of predicting the human’s next choice.
  • Over the long haul, the computer will become very difficult for humans to beat.
Clone this wiki locally