Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Assignment Specifications

The game called Hangman is a spelling game: one player sets up a word or phrase, represented by a row of dashes. If the guessing player suggests a letter which occurs in the word, the other player writes it in all its correct positions. If the suggested letter does not occur in the word, the other player draws one element of the hanged man stick figure as a tally mark. The game is over when:

? The guessing player completes the word, or guesses the whole word correctly

? The other player completes the diagram.

You must implement a simplified version of hangman in which the player gets 7 incorrect guesses (corresponding to drawing the "hanged man").

You are required to implement the specified functions and utilize any provided functions.Hangman Algorithm

? Get phrase to be solved from the user (using getlineinstead of the input operator >>to allow for the presence of spaces in the phrase)

? Clear output window so phrase is not seen, using the provided function clearScreen()

? Setup unsolved phrase so game has a separate string with dashes in place of characters (call setupUnsolvedfunction)

? Display the unsolved phrase

? Play Game until phrase is completely guessed, or all 7 incorrect guesses are used up

? Get a valid letter guess from user (call getGuessfunction - see below for meaning of "valid guess")
(After initial phrase has been set, user input should ONLYoccur in the getGuessfunction)

? Update a string consisting of all characters guessed so far

? Take action on the guess:

¦ Correct: update unsolved phrase using the updateUnsolvedfunction
¦ Incorrect: increment the wrong guess count

? Clear the screen again, using clearScreen()
? Output game status:

¦ updated unsolved phrase - phrase with dashes for still-unguessed letters
¦ list of characters guessed so far
¦ number of wrong guesses left

? Output game over message (Youlost!or Congratulations!!)

Header File

I have supplied a header file called assn.hto be utilized with this assignment: it provides the function voidclearScreen()that will clear the terminal window, to be invoked at specified spots within the algorithm. To acquire this file download it from the specs folder and upload it into your Hangman assignment directory.

Then add it to your includes:

#include"assn.h"

(Note the quotes, unlike the <>used for including C++ libraries)Additional Requirements and Hints

? Implement each functionand get feedback/credit for each before doing main game

? Alluser input statements should be followed by outputting a blank line.

? All user inputs and corresponding promptsafter initial phrase setup occur only in body of getGuess- so there are no input or output statements in setupUnsolvedor updateUnsolved

? All phrases and valid guesses will use lowercase alphabetic characters (i.e. in our testing, we will only use lower case phrases for the initial puzzle; and we will enter only lower case characters as validguesses; we will, of course, input non-alpha characters to test for invalid
guesses).

? The player gets 7wrong guesses

? You should be utilizing a single puzzlevariable to hold the current state of the game, and assigning to it the return value from setupUnsolvedinitially, and updateUnsolved subsequently.

? Use the string member function at(): Remember, at()can be used on either side of the assignment operator (=), to either "read" the value at a specified position of the string (right side); or to "write" a new value into a position of the string (left side).

The function at()"throws an exception" when you attempt to access a non-existent location, unlike the []syntax; this can be a great help when debugging.

? boolisalpha(char): In order to check if a guess is valid - i.e. if it is an alphabetic character - you can use this built-in predicate function that takes a single character as an argument.

Requires that you include the library.

? Note:The functions setupUnsolvedand updateUnsolvedare "complementary" to each other (one replaces letters with dashes, the other replaces those dashes with letters).

So once you've got one working, the other should be real simple!Functions The following 3 functions are required, exactly as declared.

You may, if you wish, define other functions in addition to these.

You must define, implement and correctly invoke these 3 functions exactly as declared here.

You may wish to copy & paste the following into your source code, and comment out the function declarations you are not yet ready to implement.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92029026
  • Price:- $40

Priced at Now at $40, Verified Solution

Have any Question?


Related Questions in Computer Engineering

1 investment risk and default risk are interchangeable

1. Investment risk and default risk are interchangeable terms and essentially mean the same thing.   2. Disadvantages of the Capital Asset Pricing Model include that you are using the past to predict the future and that ...

Listen to or read the transcript of this podcast

Listen to (or read the transcript of) this podcast (https://www.stlouisfed.org/education/economic-lowdown-podcast-series/episode-16-elasticity-of-demand) from the Federal Reserve Bank of St. Louis. describe your experien ...

In a competitive market the market demand is qd 60- 6p and

In a competitive market, the market demand is Qd= 60- 6P and the market supply is the Qs= 4P the full economic price under a price ceiling of $3 is:?

After reading this weeks materials please respond to two 2

After reading this week's materials, please respond to TWO (2) of the following questions. PROVIDE CITATION IN APA 1. Describe the controls contained within the three Access Control categories that can be integrated with ...

You run a small pizza shop named pizza hat initially you

You run a small pizza shop named Pizza Hat. Initially you sold pizzas for $8 and every week you sold around 3000 pizzas. Each pizza costs you $3 to make. One day you decided to o¤er discounts to customers to see if you c ...

Qnbspvirtualbox aside what steps do you think are required

Q) VirtualBox aside, what steps do you think are required if we bought a brand new drive and plugged it into our system internally? a. Internally / externally, does it matter? b. If we plug it into the system, will it ju ...

Structured programming is a subset of procedural

Structured programming is a subset of procedural programming. If structured programming promotes the creation of good code and procedural programs are easier to maintain, why do you need to shift to OOP? What are the pro ...

Small business e-commerce portalscheck out small business

Small Business e-Commerce Portals Check out Small Business Center and the other e-commerce portals mentioned. Then answer the questions. Note: Small Business Center and Entrabase.com are interesting sites that offer a wi ...

Mary kate is a project manager in the it department for a

Mary Kate is a project manager in the IT department for a university. She has been asked to manage a project to create faculty intranet. The university has multiple campuses in various locations, and professors and other ...

The you send it we rend it shipping company charges the

The You Send It We Rend It Shipping Company charges the following shipping costs to ship packages: Weight of Package (in pounds) Rate Per 100 miles (or partial 100 miles) shipped From 1 lb up to and including 10 lbs $ 5. ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As