Microsoft Visual C#
7th Edition
ISBN: 9781337102100
Author: Joyce, Farrell.
Publisher: Cengage Learning,
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 4, Problem 8E
In the game Rock paper Scissors, two players simultaneously choose one of three options: rock, paper, or scissors. If both players choose the same option, then the result is a tie. However, if they choose differently, the winner is determined as follows:
• Rock beats scissors, because a rock can break a pair of scissors.
• Scissors beats paper, because scissors can cut paper.
• Paper beats rock, because a piece of paper can cover a rock.
Create a game in which the computer randomly chooses rock, paper, or scissors. Let the user enter a character, r, p, or s, each representing one of the three choices. Then, determine the winner. Save the application as RockPaperScissors.cs.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
In the game Rock Paper Scissors, two players simultaneously choose one of three options: rock, paper, or scissors. If both players choose the same option, then the result is a tie. However, if they choose differently, the winner is determined as follows:
Rock beats scissors, because a rock can break a pair of scissors.
Scissors beats paper, because scissors can cut paper.
Paper beats rock, because a piece of paper can cover a rock.
Create a game in which the computer randomly chooses rock, paper, or scissors.
Let the user enter a number 1, 2, or 3, each representing one of the three choices.
Then, determine the winner.
Program should validate all user input
Game should ask the user to play again and continue if yes and stop if no.
Once the user stops playing, program should print the total number of wins.
In the game Rock Paper Scissors, two players simultaneously choose one of three options: rock, paper, or scissors. If both players choose the same option, then the result is a tie. However, if they choose differently, the winner is determined as follows:Rock beats scissors, because a rock can break a pair of scissors.Scissors beats paper, because scissors can cut paper.Paper beats rock, because a piece of paper can cover a rock.Create a game in which the computer randomly chooses rock, paper, or scissors.Let the user enter a number 1, 2, or 3, each representing one of the three choices.Then, determine the winner.Program should validate all user inputGame should ask the user to play again and continue if yes and stop if no.Once the user stops playing, program should print the total number of wins.
When the player clicks on the “Start Game” button, in every 1 seconds, three random alphabets will be generated and flashing on the screen (e.g. A X W) at the position as shown above. The three alphabets must not repeat at the same time (i.e. can’t have repeating alphabets – e.g. A X A). After starting a game, you can’t change the chosen alphabet.
Chapter 4 Solutions
Microsoft Visual C#
Ch. 4 - What is the output of the following code...Ch. 4 - What is the output of the following code...Ch. 4 - Prob. 3RQCh. 4 - If the following code segment compiles correctly,...Ch. 4 - What is the output of the following code...Ch. 4 - What is the output of the following code...Ch. 4 - What is the output of the following code...Ch. 4 - What is the output of the following code...Ch. 4 - Which of the following expressions is equivalent...Ch. 4 - Which of the following expressions assigns true to...
Ch. 4 - Which of the following expressions is equivalent...Ch. 4 - How many case labels would a switch statement...Ch. 4 - Prob. 13RQCh. 4 - Prob. 14RQCh. 4 - Which of the following is equivalent to the...Ch. 4 - Which of the following C# expressions is...Ch. 4 - Which of the following C# expressions means, If...Ch. 4 - Prob. 18RQCh. 4 - Prob. 19RQCh. 4 - Which of the following C# expressions results in...Ch. 4 - Write a program named CheckCredit that prompts...Ch. 4 - Write a program named Twitter that accepts a users...Ch. 4 - Write a program named Admission for a colleges...Ch. 4 - The Saffir-Simpson Hurricane Scale classifies...Ch. 4 - a. Write a program named CheckMonth that prompts a...Ch. 4 - Account numbers sometimes contain a check digit...Ch. 4 - Write a program named GuessingGame that generates...Ch. 4 - In the game Rock paper Scissors, two players...Ch. 4 - Create a lottery game application named Lottery....Ch. 4 - Each of the following files in the Chapter.04...Ch. 4 - In Chapter 2, you created an interactive...Ch. 4 - In Chapter 2, you created an interactive...
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Description:Create a text based game like some of the following options. Game must have a 2 player, and play againstcomputerideas:Some kind of fill in game similar to a tic tac toe, but not tic tac toeHangman type game but not hangman exactlyA card game (like 31 or high card wins, etc)A question based game similar to Who wants to be amillionaireYour own game you inventedGame must:Keep score while the player continues to play. Start score over when a new game startsShow final score to player and allow player to enter a name if they earn the high score. Name and score mustbe written out to a highscore text file. If the player chooses to see high score the program must read it infrom that file and show the name and score.Offer a main menu showing:1. Rules2. Play Against Computer3. Play 2 Player Game4. See High Score5. QuitThe user must be able to keep playing until they decide to quit. Another menu of options should appear insidethe 1 and 2 player games.The high score must be written out…arrow_forwardGame Description: Pig is a game that has two players (in our case one human and one computer) that alternate turns. Each player’s goal is to get 100 points rolled on a normal six-sided die first. Each turn consists of the rolling the die repeatedly until you get a 1 or decide to stop. As long as you roll a 2-6, you will add this amount to your total for that turn. But if you roll a 1 during your turn, your turn ends and you receive zero points for that entire turn (erasing all of the progress you made since you last agreed to stop). If you decide to stop rolling at any point in your turn, your points for that turn are then added to the overall score. The overall score is then safe from future rolls. The trick is knowing how long to push it before we should stop and save our gains. See end of this document for an example of a game of pig we should write coding as below In order to explore what is the best strategy for the computer player (i.e. at what score do we stop each computer…arrow_forwardCreate a Minesweeper game that is text-based. Minesweeper is a classic single-player computer game in which a NxN grid contains B mines (or bombs) hidden throughout. The remaining cells are either blank or contain a number. The numbers represent the number of bombs in the eight surrounding cells. The user then finds a cell. If it's a bomb, the player is out.If it is a number, it is displayed. If it is a blank cell, it is exposed, as are all adjacent blank cells (up to and including the surrounding numeric cells). When all non-bomb cells are exposed, the player wins. The player can also mark specific locations as potential bombs.This doesn't affect gameplay, other than to block the user from accidentally clicking a cell that is thought to have a bomb.(Tip for the reader: if you're not familiar with this game, please play a few rounds on line first.)arrow_forward
- Four in a row is a game in which players take turns adding tokens to the columns on the game board. Tokens fall to the lowest position in the chosen column that does not already have a token in it. Once one of the players has placed four of their tokens in a straight line (either vertically, horizontally, or diagonally), they win the game If the board is full and no player has won, then the game ends in a draw. TASK Using the following class descriptions, create a UML diagram and a version of Four in a row game The game must allow for a minimum of two and maximum of four players The game must allow each player to enter their name(duplicate names should not be accepted) The game should give the players the ability to choose how many rows (between four and ten), and how many columns (between four and ten) the game board should have. The code uses several classes, including "Player", "Board","Game" and exceptions for handling errors such as invalid moves and full columns.…arrow_forwardwhen coding a chess game, implement the following method: isInCheck(Side s): Returns true if the king of side s is attacked by any of the opponent’s pieces, i.e., if in the current board state, any of the opponents pieces can move to where the king is. Otherwise, it returns false. Note that this method is only used to warn the player when they are in check. You can use the GUI to test if this is working. public boolean isInCheck(Side side) { // TODO write this method return false; } public enum Side { BLACK, WHITE; public static Side negate(Side s) { return s == Side.BLACK ? Side.WHITE : Side.BLACK; } }arrow_forwardThe game is played in the magic maze, as shown below. The squares are flaming lava pools. If you try to cross them you will die. The grid lines are passageways and are safe to travel in. You can start at any location on the grid but must travel in the passageways. You may travel as far as you want in any direction, but once you turn, you must repeat that distance and you may only make left turns. You may not reverse direction inside the tight passageways. You must end up at the same spot you started at. If you successful, then you gain a magic coin, which automatically appears. You can start over again and again in a different or same starting spot and earn new magic coins, but the routes you take must differ somehow for each magic coin. That is, no magic coins for the exact same route as previously done. If the route varies in any way (perhaps it is the same starting location and ending location as a previous route, but longer), it will earn a new magic coin. Mad Madame Mim has…arrow_forward
- Read this case study carefully ! A team of developers plans to make a game with the adventure genre . To play the game , the user is required to enter a name . The game description is as follows : 1. The player must choose a character ( from 3 optional characters ) at the beginning of the game 2. The character wears a war hat , has a sword weapon , armor , and the ability to attack the opponent strongly . 3. Each character can move forward , backward , left , and right . In addition , characters can perform shooting , hitting , or kicking actions . 4. Users are required to complete challenges in each level as a condition to proceed to the next level . 5. In each level , the character must kill all the monsters in front of or above with the actions he can do 6. As a reward , users can collect items , such as stars , weapons , and power - ups . 7. There are five levels in the game . Create a flowchart to model the gameplay ! *arrow_forwardRock Paper Scissors Game Instructions In the game Rock Paper Scissors, two players simultaneously choose one of three options: rock, paper, or scissors. If both chose the same option, then the result is a tie. However, if they choose differently, the winner is determined as follows:• Rock beats scissors, because a rock can break a pair of scissors.• Scissors beat paper, because scissors can cut the paper. • Paper beats rock, because a piece of paper can cover a rock. Create a game in which the computer randomly chooses rock, paper, or scissors. Assign the number 1, 2, or 3 to represent one of the three choices. Let the user enter a number. Then determine the winner by comparing the user input and the randomly generated choice of the computer. Additional instructions: • The Program should validate all user input.• Game should ask the user to play again and continue if yes and stop if no.• Once the user stops playing, program should print the total number of wins. Java…arrow_forwardRock Paper Scissors Game Instructions In the game Rock Paper Scissors, two players simultaneously choose one of three options: rock, paper, or scissors. If both chose the same option, then the result is a tie. However, if they choose differently, the winner is determined as follows: • Rock beats scissors, because a rock can break a pair of scissors. • Scissors beat paper, because scissors can cut the paper. • Paper beats rock, because a piece of paper can cover a rock. Create a game in which the computer randomly chooses rock, paper, or scissors. Assign the number 1, 2, or 3 to represent one of the three choices. Let the user enter a number. Then determine the winner by comparing the user input and the randomly generated choice of the computer. Additional instructions: • The Program should validate all user input. • Game should ask the user to play again and continue if yes and stop if no. • Once the user stops playing, program should print the total number of wins.arrow_forward
- The goal of Snake is to create a snake as long as possible. This is achieved by guiding the snake to an apple on the game board. The snake cannot stop moving, and dies whenever it hits something (excluding apples). Because the snake is growing longer and longer as the game progresses, it gets increasingly difficult to avoid collisions with the snake itself. The player can change the direction of the head of the snake by using the arrow keys. At step in the game, there is always an apple somewhere on the board. If the snake eats an apple, the snake becomes one cell longer. A new apple is placed on a random location, excluding all places covered by the snake. When the snake reaches a side of the game board, it re-emerges at the opposite end.arrow_forwardMagic 8 Ball Lab Introduction For this lab, you are going to build a simple magic eight-ball, so you no longer have to make any choices. On that note, if you haven’t, you should watch Interstate 60. All joking aside, you will build a 15 sided magic 8-ball, just for simplicity (an actual one has 20 sides for choices). If you are curious about all the choices, you can read up more on them here. Also, if you need a refresher on if statements, go here. Step 1 - Reading the code First take a look at the provided code. You should change the comments to include your name at the top of the file. Furthermore, you will notice all the functions are ‘stubbed’ out for you. This means we have provided the function signature, and a dummy return value that you will replace completely. We have also provided one function in its entirety, so you can use it as a sample/template to look at. def get_positive_answer(answer): ans = "You may rely on it." if answer == 0: ans = "As I see…arrow_forwardcreating a roulette wheel. The pockets are numbered from 0 to 36. The colors of the pockets are as follows: Pocket 0 is green. For pockets 1 through 10, the odd-numbered pockets are red and the even-numbered pockets are black. For pockets 11 through 18, the odd-numbered pockets are black and the even-numbered pockets are red. For pockets 19 through 28, the odd-numbered pockets are red and the even-numbered pockets are black. For pockets 29 through 36, the odd-numbered pockets are black and the even-numbered pockets are red. Create a class named RoulettePocket. The class's constructor should accept a pocket number. The class should have a method named getPocketColor that returns the pocket's color, as a string. Demonstrate the class in a program that asks the user to enter a pocket number, and displays whether the pocket is green, red, or black. The program should display an error message if the user enters a number that is outside the range of 0 through 36.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Java random numbers; Author: Bro code;https://www.youtube.com/watch?v=VMZLPl16P5c;License: Standard YouTube License, CC-BY