Provide function voidclearscreen that will clear the window

Assignment Help Computer Engineering
Reference no: EM131274304

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

Reference no: EM131274304

Questions Cloud

How should the court have ruled : How should the court have ruled? What legal precedents discussed in this case are likely to be relevant to this opinion? Why?
What audience demographic are you targeting : Imagine that the Chicago Cultural Center or the MCA has commissioned you to do an installation on a particular facet of Chicago's Musical Heritage. Your job is to design such a public installation. What topic will you choose? How will it be presen..
Roles and responsibilities of management accountants : Implementing Activity - Based Costing - analysis and report about that case 17 pages - and power point with important information 8 slides.
Continuous quality improvement and productivity improvement : Continuous Quality Improvement (CQI) and Productivity Improvement (PI)are closely related, but are not the same. Compare and contrast these concepts. Your answer should include a brief definition of each. Briefly discuss whether quality improvemen..
Provide function voidclearscreen that will clear the window : 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.
Discuss what you discovered about contingency planning : Interview someone you know who is in a management role. This can be at your current place of employment or someone that you know personally who works in a managerial role. Prepare a 700-word discussion of the interview including the following:
How should the court have ruled : How should the court have ruled? What legal precedents discussed in this case are likely to be relevant to this opinion? Why?
An amendment to the states constitution : The Alabama legislature was considering an amendment to the state's constitution that would require that certain construction projects be performed only by Alabama copanies or companies that only hired Alabama residents. - How do you think the cou..
Explain the pros and cons associated with countertrade : Select one theory from each category and discuss how it has affected the patterns as well as the benefits associated with cross-border trade and investment activities. Discuss the factors that would necessitate the need for nations to engage in Cou..

Reviews

Write a Review

Computer Engineering Questions & Answers

  Organizational structure in large public sector organization

However, is it possible that in many countries, taller organizational structures are preferred as they allow more checks and balances to be put in place, to inhibit public-sector corruption and other undesirable practices.

  Express how the required task can be achieved

The parameter element is a data item to be added to the array. The parameter position is the array index at which the new element will be inserted. be sure to account for elements that must be moved over to make room for the new element.

  Define some uses of this instruction

Many instruction sets include the instruction NOOP, meaning no operation, which has no effect on the processor state other than incrementing the program counter Suggest some uses of this instruction.

  Developing the c++ code

Write down a C++ code in order to execute the following application: If you press on “Sum” button, summation of all the multiple of 4 numbers greater than 0 and less than 100 will be found and the result will be displayed in result edit box.

  Assume a direct access file consists of sectors

assume a direct access file consists of sectors with 1024 byte capacity. Suppose also that records are 32 bytes long. On which logical sector do the following logical records lie? What is the relative record number in the sector?

  What is the publisher trying to optimize

A small magazine publisher wants to determine the best combination of two possible magazines to print for the month of July. Backyard magazine, which he has published for years, is a steady seller. The publisher wants to make sure he prints at lea..

  What is meant by creating a workaround for software package

What is meant by creating a workaround for a software package? What are the disadvantages of workarounds (if any)?

  Overviewwrite a program to calculate the component voltages

overviewwrite a program to calculate the component voltages for the following series resonant rlc circuit.the input

  Determinants of site success such as trusera

Determinants of site success such as Trusera (invitation only), DailyStrength, PatientsLikeMe, and Caring.com rest with a triad of: blog ratings, site ratings, and community forum ratings.

  Implement the system using sockets programming

Design and implementation details and a CD having the system source code -  implement the system using sockets programming for message exchange over TCP/IP. You may choose any programming language provided that it provides low-level socket APIs.

  Note down an applet that simulates a soft drink machine

Write down an applet that simulates a soft drink machine. The simulated machine dispenses the following soft drinks: cola, lemon-lime soda, grape soda, root beer, and bottled water. These drinks cost $0.75 each to purchase.

  In this question you will test using a backtracking

in this question you will test using a backtracking algorithm if a mouse can escape from a rectangular maze.the

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd