Guess My Number (High-Low) Two Players Take Their Turn
Create a program that will simulate the child's number guessing game with two players who will play against the computer. The program should have the following requirements:
1. When the program is invoked the computer will pseudorandomly choose which player will go first.
2. Play begins when the computer interface asks "Player Number". A player number (either 1 or 2) is entered from the keyboard. If a player enters their number at the keyboard and it is not their turn the computer will report back "You have to wait your turn" and return to the query "Player Number". If it is a player's turn the computer will query "Enter Your Guess". The player may either enter a guess or indicate a desire to pass the play to the other player by entering the word PASS at the prompt. If the player enters a guess the computer will report back that the guess is too high, too low or correct and return to the query "Player Number" and pass play to the other player.
3. No player may pass two turns in a row, and cannot exceed more than three passes for the entire game. If the player chooses to pass the computer should report "You have passed X number of times, you have Y more times left" before returning the query "Player Number".
4. The play progresses until one user provides a correct guess.
5. The program must be written in C and must be able to be compiled a.
6. A professional quality pseudocode document must be provided.
7. The source for the C program must be commented using best professional effort and should contain elements of the pseudocode as comments.© BrainMass Inc. brainmass.com September 27, 2022, 4:25 pm ad1c9bdddf
SOLUTION This solution is FREE courtesy of BrainMass!
Initialize player turn (t) as integer, player number (pNumber) as integer, user input (input) as string, pass count, currentPlayer as integer, and numberToGuess as integer
Generate random number between 0-100 and assin it to numberToGuess
Display "LET THE GAME BEGIN"
Generate player turn t
Ask player number (pNumber)
While pnumber is not equal to t
Ask player number pNumber
Set Label guessAgain
Display "Enter your guess (1-99) or pass ="
Get user input input
Check if input is equal to "pass"
Check for maximum pass reached
Goto label guessAgain
Else if user already passed once
Goto label guessAgain
Else count total number of pass
Assign currentPlayer t
Display the number of times user has passed and passes left
Else user entered a guessing number
if the number is greater than numberToguess
Display "Too high"
Else if the number is less than numberToGuess
Display "Too low"
Break the whilte loop
While answer is correct
Display "Congratulations! You won."© BrainMass Inc. brainmass.com September 27, 2022, 4:25 pm ad1c9bdddf>