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

Assignment Help:

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


    f--

Previous guesses: f

Guess a character? u
Incorrect guess: 1

   f--

Previous guesses: fu
Guess a character? i

   f--i

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

   f--i

Previous guesses: fuip
Guess a character? r

   fr-i

Previous guesses: fuipr
Guess a character? e


Congratulations
- You win!


The word is frei

Task

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:

 

1486_hangman.png

 

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?


Related Discussions:- Wap for the game hangman-using functions with txt graphics

Do i require checking for null before delete p?, No. it's not required T...

No. it's not required The C++ language guarantees that delete p will do nothing if p is equivalent to NULL. As you might get the test backwards, and as most testing methodologie

C program to add two polar coordinates, Aim: To implement a program to add...

Aim: To implement a program to add two polar coordinates using operator overloading. Code:                       #define PI 3.14 class polar {             double

Wap to print the largest number from any 10 numbers, WAP TO PRINT THE LARGE...

WAP TO PRINT THE LARGEST NUMBER FROM ANY 10 NUMBERS #include stdio.h> #include conio.h>   void main()   {                    int a[10],i,max;

Create program to newtons method for cube roots, Newton's method for cube r...

Newton's method for cube roots is based on the fact that if y is an approximation to the cube root of x, then a better approximation is given by the value: (x/y 2 +2y)/3 (a)

Explain about evaluation of expression in c language, Explain about Evaluat...

Explain about Evaluation of Expression in c language? An Expressions are evaluated using an assignment statement of the form: variable = expression; The Variable is any v

Is it possible to pass an entire structure to functions, Is it possible to ...

Is it possible to pass an entire structure to functions? Yes, it's possible to pass an entire structure to a function in a call by method style. Some programmers prefer to decl

Logic families and lsi devices, We have used logic symbols in the past, but...

We have used logic symbols in the past, but not really though about the actual real devices. Semiconductor companies have taken the logic symbols are manufactured them into logic f

C program for removing specified charecter , #include stdio.h> #include ...

#include stdio.h> #include conio.h> #include string.h>   void del(char[],char *); main() {           char str[30],ch,*pp;           clrscr();           p

Functions and stack frame, Each function has its own stack frame between %f...

Each function has its own stack frame between %fp and %sp. Let Caller calls Callee. Then Caller's %sp becomes callee's %fp, and callee's %sp set to be a new value (a smaller one be

#CompilerRelated, #C Why don''t online compilers support the header file?...

#C Why don''t online compilers support the header file? What can I do to resolve this? PS. I have tried , does''nt work either. Thannk in advance.

Write Your Message!

Captcha
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