Project 3 –Rock, Paper, Scissors

Due: Friday, February 25th, 2005

 

For your next project, you will be implementing the game of Rock, Paper, Scissors. For those unfamiliar with the rules, typically the game is played with two people who use hand gestures to represent a rock (closed fist), paper (an open hand), or scissor (a vee made with your fingers.) Each person displays their choice at the same time and the winner is determined by (winner in bold):

 

Scissors cut paper, paper covers rock, rock breaks scissors

 

Your job will be to write a program where a human can play against the computer in a best-of-5 tournament. The first to win three games wins the match. Have the human player enter their choice, and then have the computer randomly pick its choice. If the two match, the game is a tie and doesn’t count. Otherwise you will add one to the score of the winner. After the match is over, you should ask the user if they would like to play again.

 

Example:

Welcome to Rock, Paper, Scissors

 

Would you like to play? yes

 

What is your choice? scissors


The computer chooses rock. You lose this game!

The score is now you: 0 computer: 1

 

 

 

Source to help you:

import tio.*;

 

class RockPaperScissors {

      public static void main(String[] args) {

 

      }

 

      public int computerChoice() {

            return (int)(Math.random() * 3);

      }

}

 

Hints: