The assignment requires creating a Paper-Rock-Scissors game application where a player competes against the computer. Players will input their names, select the number of rounds, and make their choices, while the computer randomly selects its choice. The game includes validation of inputs, tracking scores, and displaying results after the specified rounds are completed.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
26 views3 pages
Assignment 03 - Paper Rock Scissors
The assignment requires creating a Paper-Rock-Scissors game application where a player competes against the computer. Players will input their names, select the number of rounds, and make their choices, while the computer randomly selects its choice. The game includes validation of inputs, tracking scores, and displaying results after the specified rounds are completed.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3
Assignment #3 – CIS 130
You will make the following Paper – Rock - Scissors game application work allowing a player to play against the computer as an opponent. Here is the windows form:
Overall explanation of game:
You will play against the computer (opponent). You will enter the number of rounds (1, 3, 5, 7 or 9), the opponent’s (computer) name and your name. Click the Start Game button. You will select either Rock, Paper or Scissors and click the Play button. The computer will randomly select one of the three as well when the Play button is clicked. The winner of that play is determined by the following: Paper vs. Rock Paper wins since it can cover the rock. Paper vs Scissors Scissors can cut paper, so Scissors wins in this scenario. Rock vs Scissors Rock wins since it can break the scissors. If both results are the same then it is a tie and it is ignored, another play will be done. Rounds: indicates how many plays are done before the results of the game are displayed. Remember a tie does not count towards a play. Therefore, if 3 rounds are selected then there will have to be 3 different plays where there are no ties. Your To Do list: 1. Download/Copy the Assignment03 project from the Moodle course and copy it to your Assignment03 folder. 2. Code the Exit button to exit the application. 3. You will need to define the following fields variables for this application. Start all variable names with the underscore character “_”: a. A new instance of a Random object. b. An integer for the rounds that will be selected in the ComboBox control. c. An integer to keep track of how many plays an opponent won during a round. d. An integer to keep track of how many plays you won in a round. 4. Form Load Event. a. ComboBox control: Code a for-loop structure to add the following integers to this control: 1, 3, 5, 7 and 9. An integer value should not be pre-selected when the form appears. You add an item to a ComboBox control just like a ListBox control.
5. Start Game Button Click Event.
a. The following data must be validated: i. Opponent name (computer) is required, it cannot be empty. ii. Your name cannot be empty. iii. The number of rounds must be selected (1,3, 5, 7, or 9). The Text property of the ComboBox control will be empty if the user does not select anything. iv. Finish coding the bool method IsValidStart that will return true if the above data is good or false if any data is invalid. You can use the Validator class to contain methods that will validate the input data as described in chapter 7. b. You will call the IsValidStart() method to see if the above data is good. If the validation is false then exit the Start Game button click event, otherwise do the following: i. Set field integer variable to the value contained in the rounds combo box control. ii. Set ProgressBar control Minimum to 0 iii. Set ProgressBar control Maximum to the value of Rounds that were selected. iv. Set ProgressBar control Value to 0. v. Game Start Group Box control must be hidden, set Visible property to false. vi. Playing Game Group Box control must be visible. vii. Your Choice Group Box control must be enabled, set Enabled to true. viii. Display names in TextBox controls in Labels located in the Playing Game Group Box control. 6. Play Button Click Event. a. Make sure the player has selected one of the radio buttons. If not let them know about it and do not continue in this event. b. You will need to declare two integer variables, one representing your choice and the other for the computer’s choice. Values used must be 1 for Rock, 2 for Paper and 3 for scissors. The value for the opponent will come from the Random Next method. c. If the two integers are the same, then display a message that you both selected the same choice. This will not count as a play for a round. You will exit this event. d. Call the DisplayImages() method passing in two arguments. i. You must complete the DisplayImages method that will display the correct images based upon the values of the two integers. This method has been started for you! e. Call the CompareChoices method passing in two arguments. i. This method should determine the winner for the current play. It should also add to the correct counter variables. Using the MessageBox class, display the name of the person who won the current play. Lastly, if this was the last play based upon the rounds selected then call the following methods: 1. DisplayGameResults(). Finish this method- Display the correct information in the Game Results form. 2. ResetForNewGame(). Finish this method. Use the comments written in this method.