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
Bitwise Operations 1. Write a function that has an int parameter n, makes an integer mask having the bit 1 at the nth place from the rightmost bit, and returns the mask. For ex

Question 1 What are the different steps in executing a C program? Explain Question 2 What are the commonly used input/output functions in C? How are they accessed?

Program to design list in c: Write a program in c to insert the values in list void main() { int i=0; char a[20]; clrscr(); printf("Enter the line\n");

array of class objects and single inheritance

E v o l u t i o n of Software: In the past stage of programming the software's were developed in Machine language Using binary numbers 1's and 0's.  Later it convert

Assume we wish to partition the square roots of the integers from 1 to 100 in to two piles of fifty numbers every, such that the sum of the numbers in the first pile is as close as

Program is to swap the two values which are enter by user: Program is to swap the two values which are enter by user through the function with values changed using pointers

A: Use references when you can use, and use pointers when you have to. References are generally preferred over pointers whenever you don't require "reseating". Usually this mean

Write a ''C'' program to accept any 3 digit integer number from the keyboard and display the word equivalent representation of the given number.

Project Description: P2P media streaming browser (IE, Chrome, Firefox) plug-in needed that is compatible with Win Xp,7,8 that is Windows Firewall friendly Example like Swarm