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

What is the maximum number of constructors, Question: (a) (i) Explain...

Question: (a) (i) Explain how class members can be accessed when using objects of the class. Use a suitable example to illustrate your answer. (ii) Explain how the privat

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

Define the c preprocessor, Define the C Preprocessor? Preprocessor' is ...

Define the C Preprocessor? Preprocessor' is a translation stage that is applied to your source code before the compiler proper gets its hands on it usually the preprocessor per

GPA Calculator, I am having trouble declaring a variable and returning a va...

I am having trouble declaring a variable and returning a value from my function.

Develop pidgin for windows, Develop Pidgin for Windows Project Descripti...

Develop Pidgin for Windows Project Description: I want to build Pidgin (open source instant messenger) for Windows with D-Bus support enabled. I've effectively built both

Padovan string, a padovan string p(n) for a natural number n is defined a...

a padovan string p(n) for a natural number n is defined as p(0)=''x'' p(1)=''y'' p(2)=''z'' p(n)=p(n-2)+p(n-3),n>2

#, YOU HAVE GIVEN THE MARKED UP PRICE OF 80% AND DISCOUNT PRICE OF 10% THEN...

YOU HAVE GIVEN THE MARKED UP PRICE OF 80% AND DISCOUNT PRICE OF 10% THEN FIND THE SELLING PRICE

Need help, how to make basics strong and best logic skills what are the bes...

how to make basics strong and best logic skills what are the best way to be a expert programmer ? what counts a lot knowledge or practice?

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