For this assignment you will be replicating the game of Roshambo (aka rock, paper, scissors). answer both parts a and b of the following question

For this assignment you will be replicating the game of Roshambo (aka rock, paper, scissors). answer both parts a and b of the following question below. Show the R code in your answer and annotate all parts of the code. a.) First, you need to come up with a strategy to win the game. Write a function in R that takes in a vector of past plays for your opponent (each play should be represented as “R”, “P”, or “S”) and outputs the next move (“R”, “P”, or “S”). Your strategy should at least depend on the last two moves used, but you should return a random move if there is not enough past history to use the strategy. b.) Now, play your strategy against a random player who uses rock, paper, or scissors with 1/3 probability each. Who wins the most rounds after 100 rounds of play? Write a function in R.

Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadline.


Click Here to Make an Order Click Here to Hire a Writer