Purchase Solution

Simulating a Guessing Game, Two Players Against the Computer

Not what you're looking for?

Ask Custom Question

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.

Purchase this Solution

Solution Summary

The attached solution provides a well written easy to understand pseudocode, a working code in c, attached visual studio solution files, and a screen shot of the output. The code is well commented. Highly recommended for beginners to learn from.

Solution Preview

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 ...

Purchase this Solution


Free BrainMass Quizzes
Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Basic Networking Questions

This quiz consists of some basic networking questions.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.