Wap for the game hangman-using functions with txt graphics, C/C++ Programming

The game of hangman may have originated in the Victorian era, and involves trying to guess a word by suggesting letters. The game is played as follows: A word is chosen and the player is invited to guess the word one letter at a time.

A version of hangman using a program would prompts the user by displaying correct guesses in position after each round of guessing. For the ?rst round an underscore character for each letter in the word is displayed. For example, suppose that the computer chooses the word bench, from the dictionary the computer would display 5 underscore(_) or dash(-) characters:

!- - - - -

The player then guesses a character that they think is in the word. In the above example, any of the characters b, e, n, c, and h would be correct guesses as they appear in the word bench. When a correct character is guessed, this character is displayed in all the positions it appears in the word. If, for example, the player guessed the letter e, then the letter e would be displayed in position 2:

!- e - - -

If an incorrect guess is made the player is informed and the game increments the number of incorrect guesses. As the game progresses, the player gradually guesses more characters that appear in the word. The game ends when either all the characters in the word are guessed and the word is revealed (in this case the player wins), or a speci?ed, maximum number of incorrect guesses are reached (the player loses).
Consider the following sample program output (with 10 guesses):

Enter a word (up to 6 letters): frei  
Welcome to H A N G M A N
You must attempt to guess a word of length: 4

    ---Previous guesses: 

       Guess a character? f


Previous guesses: f

Guess a character? u
Incorrect guess: 1


Previous guesses: fu
Guess a character? i


Previous guesses: fui
Guess a character? p
Incorrect guess: 2


Previous guesses: fuip
Guess a character? r


Previous guesses: fuipr
Guess a character? e

- You win!

The word is frei


Write a program to play Hangman, allowing words of up to length 6. The run of the program should be something similar to that shown above:
1. Ask the user for a word.
2. Ask the player to guess a letter in the word. 3. Search for the letter in the word.
1. If it exists, print the word with the letter “revealed” and the remaining unguessed letters shown as dashes “-”. Add the letter to the previous guesses list.
2. If it doesn’t exist, add it to the previous guesses list and increment a counter. When the counter hits 10 incorrect guesses, the game ends and the player loses.
4. If the all the letters in the word are uncovered before 10 incorrect guesses, the game ends and the player wins. If more letters are to be guessed, go back to Step.2.
Your program should be modular, i.e. use functions (more than one function, and main counts as 1 function).
Your program should use arrays and/or strings to function properly.
If you want an added challenge, you can add text graphics. For example:




But you don’t have to do this.

Learning Outcomes Upon completing this assignment, students will be able to design and implement a basic program using the speci?cations provided. Students will build skills in algorithm design, program input/output, numerical calculations, basic decision statements, repetition, functions, programming style and usability.

Grading Criteria

This assignment is graded using Rubric 5. Please refer to the document “Assignment Guidelines” for detailed information on the grading criteria.NOTE: If your program does not compile, the assignment receives an automatic grade of zero. There are no regrades on a program which does not compile.

Academic Misconduct

This is an individual assignment. You may not collude with any other individual, or plagiarize their work. This course uses software to systematically inspect all solutions for possible plagiarism. Please refer to the Academic Integrity policy of the course outline.

Submission Policy

Assignments must be submitted electronically via Courselink before 11pm on the day they are due. Late assignments will not be accepted; consequently, you should aim to ?nish early, to allow for unexpected delays. Submit early and often. Each time you resubmit, your old submissions will be overwritten. There is no excuse for never having submitted an attempt.

The following is a list of items which should be considered before submitting your assignment.

Have you read the assignment guidelines?
Have you compiled your program on a lab system to make sure it works?
Have you tested the program properly?
Did you comment your code? If you don’t know whether your commenting is too much or too little, check an example in the text, or from class.
Did you include a program header?
Have you used proper style? (e.g. indented code 4 spaces, paragraphing between sections of code, whitespaces where appropriate?
Does your program have variables with good names?
Are your user prompts usable?
Does your ?le have a .c extension?
Is your program modular?
Have you tested your program to make sure it works?

Posted Date: 2/14/2013 6:44:01 AM | Location : United States

Related Discussions:- Wap for the game hangman-using functions with txt graphics, Assignment Help, Ask Question on Wap for the game hangman-using functions with txt graphics, Get Answer, Expert's Help, Wap for the game hangman-using functions with txt graphics Discussions

Write discussion on Wap for the game hangman-using functions with txt graphics
Your posts are moderated
Related Questions
2 flowcharts, pseudocode for each (at least 4 algorithms), and code for either a stack or a queuestion..

how can I find the GCD of 2 given numbers using Euclidean Algorithm ?

Write a program called plus that will display asterisks in the shape of a plus sign which has the height and width specified by the user. You must only allow entry of an odd numb

i didnt no how to write and how to implement and the programming can be done in C and execution should be done in UNIX

A: Multiple providers of libraries might employ common global identifiers causing a name collision whereas an application attempt to link with two or more such libraries. The names

find area under the curve y=f(x) between x=a &y=b integrate y=f(x)

Abstract array - c program: AbstractArray::AbstractArray( int anUpper, int aLower, sizeType aDelta ) {     PRECONDITION( anUpper >= aLower );     lastElementIndex = a

Define the Relational Operator in c language? The Relational operators refer to the relationships that values can have with one another and they are used to compare two operand

Selection sort - C program: Write a program to define a selection sort. void main()  {   clrscr();   int a[100],ch,n;   cout   cin>>n;   for (int i=0;i

Draw pie chart in c++ program: int main() {                 char cmd;                   cout                 cout                 cmd = toupper(getch());