Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

MUST BE WRITTEN IN C!!! Screenshots of the program are ideal. Need help with this program; must use all the functions required and the program's

MUST BE WRITTEN IN C!!! Screenshots of the program are ideal. Need help with this program; must use all the functions required and the program's output must be the indicated.

image text in transcribed

image text in transcribed

image text in transcribed

Problem Statement Many students get into computer science to write video games. For this problem, you are to develop a simple computer game that allows two users to play one match of Rock, Paper, Scissors, Lizard, Spock. In the traditional game of Rock. Paper, Scissor, players simultaneously choose one of the eponymous elements by flashing a hand gesture and comparing the results. The additional elements of Lizard and Spock were added by Sam Kass and Karen Bryla and popularized by the TV show The Big Bang Theory. The winner is chosen based on what winning action one element can do to another as follows .Scissors cuts Paper (i.e. Scissors beats Paper, etc.) Paper covers Rock. Rock crushes Lizard Lizard poisons Spock. Spock smashes Scissors Scissors decapitates Lizard Lizard eats Paper Paper disproves Spock Spock vaporizes Rock. Rock crushes Scisso If both players choose the same element, then the match is a tie. Program Specifications For this assignment, you are given the program specification in the form of an analysis and design for a series of functions that must be implemented to earn full credit for the project. Each function accomplishes one task needed for this program. You should write a function and then test it with a main program that ensures that the function works by itself. Once the function is working, move on to the next function, which will require a different main function to test it. Once all of the individual functions work, the final main function that actually plays the game is written Function: print greeting Analysis: no parameter or returned objects Design: This function's task is simply to print out the greeting at the beginning of the program. See the sample run for the exact text format Main Program Analysis Function: get pick character picked by first user character picked by second user winner of the match r user picked converted o upperhar Design: This function's task is to prompt a (single) user by player number to enter either R for Rock, P for Puper, S for Scissors, L for Lizard, or K for Spock, and return the character entered in uppercase. Here are the steps to Design: Finally we arrive at the main function of the program, now that we have all the pieces. 2. 3. 4. Ask the user by player number for an input of R. P. S, L, K Read in the input Convert the input to uppercase Return the input Print the greeting using the print greeting function 2. Get first users pick using the get-pick function 3. Get second users pick using the get pick function 4. Print out the players' picks using print pick 5. Determine the winner using compute_winner function 6. If the winner value is negative, print "Player 1 wins!" 7. If the winner value is positive. print "Player 2 wins!" 8. Otherwise, print Tie!" 9. Return 0 to exit the program s function .See the sample run for the exact text format of the prompt. " Read the user's input using: canf (" %c" , &ch); Note there is a space before the % symbol. This will make scanf ignore any whitespace before the input Convert ch to uppercase using the toupper function in the library. Don't forget to include the library at the top of your file. The toupper function receives a character argument and returns the uppercase equivalent for alphabetic letters. If the argument is not a letter, the function retuns Assignment Write a C program that implements the game of Rock. Paper. Scissors, Lizard, Spock that allows two users to play. Your program must follow the specifications given above to earn full credit. That is, your program must define and use at least the specified functions (The names of functions and variables do not have to be cxactly the same, but the number and types of the parameters must be as specified.) REMEMBER! Test this function (and all other functions) with a throwaway main function Function: print picks The output of the program must conform exactly to the following example runs (there are 4 separate runs shown: user input shown in bold). Note there is no blank line between the program heading and the user input prompts and there is a blank lne before the first line of output. And as usual, there must be a newline after the last line of Type Movement Name character picked by first use character picked by second user Welcome to the RPSLK Gane! Let's play!! Player 1, Pick (R)ock, P)aper, S)cissors, (L)izard, Player 2, Pick R)oek, [Paper, (s)eissors, ()izard, Design: This function's task is to print out what each user has picked. E.g. Player I chose Rock". "Player 2 chose Paper. If a user's pick is not R. P.S. L, or K. it should print "Player chose Unknown. See the sample run for the exact text format Spoc (K): Spoe (K): R p or or Player 1 chose Rock Player 2 chose Paper Player 2 wins! character picked by first user character picked by second user Melcome to the RPSLK Gane! Let's play!! Player 1. Pick (R)ock, P)aper, S)cissors, (L)izard, or Spoc (K): s Player 2, Pick (R)ock, P)aper, S)cissors, (L)izard, or Spoc(K) L Design: This function's task is to return a number that represents the outcome of the match. It will return -1 if the first user wins, a 1 if the second user wins, and a 0 if the match is a tie. Ifuser's pick is not R. P. or S. then that user loses, unless both users' picks are invalid, then the match is a tic. Player 1 chose Scissors Player 2 chose Lizard Player 1 wins! Welcome to the RPSLK Game! Let's play!! Player 1, Pick (R)ock, (P)aper, (S)cissors, (L) izard, or Spoc (K): g Player 2, Pick (R)ock, (P)aper, (s)cissors, (L)Izard, or Spoc (K): K Player 1 chose Unknown Player 2 chose Spock Player 2 wins! Welcome to the RPSLK Game! Let's play!! Player 1, Pick (R)ock, (P)aper, (S)cissors, (L) izard, or Spoc (K): g Player 2, Pick (R)ock, (P)aper, (S)cissors, (L) izard, or Spoc (K) h Player 1 chose Unknown Player 2 chose Unknown Tie

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions