Task

Implement the classic children's game Rock-paper-scissors, as well as a simple predictive   AI   (artificial intelligence)   player.

Rock Paper Scissors is a two player game.

Each player chooses one of rock, paper or scissors, without knowing the other player's choice.

The winner is decided by a set of rules:

   Rock beats scissors
   Scissors beat paper
   Paper beats rock


If both players choose the same thing, there is no winner for that round.

For this task, the computer will be one of the players.

The operator will select Rock, Paper or Scissors and the computer will keep a record of the choice frequency, and use that information to make a weighted random choice in an attempt to defeat its opponent.



Extra credit

Support additional choices   additional weapons.




10 COMPUTER=RND(3)+1
20 COMPUTER$="ROCK"
30 IF COMPUTER=2 THEN COMPUTER$="PAPER"
40 IF COMPUTER=3 THEN COMPUTER$="SCISSORS"
50 INPUT "ROCK, PAPER OR SCISSORS? ",HUMAN$
60 IF HUMAN$="ROCK" THEN GOTO 100
70 IF HUMAN$="PAPER" THEN GOTO 100
80 IF HUMAN$="SCISSORS" THEN GOTO 100
90 PRINT "INVALID GUESS. TRY AGAIN.": GOTO 50
100 PRINT "YOU CHOSE "HUMAN$" AND THE COMPUTER CHOSE "COMPUTER$"."
110 IF HUMAN$=COMPUTER$ THEN PRINT "THOSE ARE THE SAME CHOICES";", SO YOU TIED."
120 IF HUMAN$="ROCK" AND COMPUTER=2 THEN PRINT "PAPER COVERS ROCK, SO YOU LOSE."
130 IF HUMAN$="ROCK" AND COMPUTER=3 THEN PRINT "ROCK BLUNTS SCISSORS";", SO YOU WIN."
140 IF HUMAN$="PAPER" AND COMPUTER=1 THEN PRINT "PAPER COVERS ROCK, SO YOU WIN."
150 IF HUMAN$="PAPER" AND COMPUTER=3 THEN PRINT "SCISSORS CUT PAPER";", SO YOU LOSE."
160 IF HUMAN$="SCISSORS" AND COMPUTER=1 THEN PRINT "ROCK BLUNTS SCISSORS";", SO YOU LOSE."
170 IF HUMAN$="SCISSORS" AND COMPUTER=2 THEN PRINT "SCISSORS CUT PAPER, SO YOU WIN."10 COMPUTER=RND(3)+1