0% found this document useful (0 votes)
189 views3 pages

Hangman I: Submit Assignment

This assignment asks students to create a basic Hangman game program. The program should include a menu with options to play a game, view statistics, or quit. If the user chooses to play, the computer randomly selects a secret word and the user guesses letters. The user has 10 tries and earns/loses points depending on correct/incorrect guesses. The game ends if the user finds the word or runs out of tries. Test scenarios must be included.

Uploaded by

Muhammad Salman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
189 views3 pages

Hangman I: Submit Assignment

This assignment asks students to create a basic Hangman game program. The program should include a menu with options to play a game, view statistics, or quit. If the user chooses to play, the computer randomly selects a secret word and the user guesses letters. The user has 10 tries and earns/loses points depending on correct/incorrect guesses. The game ends if the user finds the word or runs out of tries. Test scenarios must be included.

Uploaded by

Muhammad Salman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

3/1/2021 Hangman I

Hangman I
Submit Assignment

Due Feb 28 by 11:59pm Points 100 Submitting a file upload


Available after Feb 5 at 12am

The Hangman Game

This week we will start developing a simple version of the Hangman game, which you will be improving
in the upcoming weeks, to reach the final version submitted during week 8.

The purpose of this assignment is to be able to apply the following programming concepts towards the
creation of a well-structured program, which produces the correct results: arrays, loops, decision
statements, expressions, variables and console i/o.

This version of the game will have the following requirements:

Create a menu for the user to choose from, similar to the following:

1. Play a game
2. Display statistics
3. Quit

The following actions should take place based on the menu. If the user chooses:

1. Play the game: Ask for the player’s (user’s) name and store it. The computer randomly
(https://www.tutorialspoint.com/c_standard_library/c_function_rand.htm) chooses a secret word from
10 words available and stored in a 2D array of characters. Assume 30 characters as a fixed
maximum length of each word. Display underscores to the player depending on the number of letters
the chosen word has. Say the word chosen was mystery. You need to display 7 underscores: _ _ _
_ _ _ _ . Ask the player to guess a letter. Check if the letter is included in the secret word and
display. Ex. if the user chooses y, then you should display _ y _ _ _ _ y . The player has 10 tries to
https://capitol.instructure.com/courses/6298/assignments/88242 1/3
3/1/2021 Hangman I

correctly find the word. Moreover, you need to change the player’s score depending on the
following criteria:

Criteria Points

Letter found 10

Letter not found -2

Word found 100

Word not found -40

Note: If the player chooses a letter which he/she has already chosen before, display a message and let
the user try again without changing the points earned so far, nor decrementing his total tries.

The game ends when the player has found the word or when all the available tries are used up. Once
the game ends, display the player’s name and score. Afterwards go back and display the initial
menu.

2. Do nothing for now.


3. Quit the game.

We have not yet learned how to read in a string, store and display it, so please use the following code to
perform this task:

You will need to demonstrate arrays, loops, if-else and switch/case statements and use of functions (and
passing arrays to functions) in this program. No global variables are allowed! You can use the
following naming convention (or anything you choose, but you need to stick to it!): camel casing for
variable names, Pascal casing for functions and all capital for constants. Do not forget to comment your
code where necessary. The minimum is a function header for each function and a program header to

https://capitol.instructure.com/courses/6298/assignments/88242 2/3
3/1/2021 Hangman I

explain what your program does. All code should be written in a single .c file. Test your program to make
sure it works properly. Assume no error checking for invalid data. You should handle the case where the
user enters anything different than 1, 2 or 3, in the menu though.

Students who do not follow these requirements, but instead submit something totally different,
will receive a grade of 0 with no option to resubmit. Any cases of plagiarism will be reported.

Please submit two files:

1. A single .c file with all your code.


2. A Word document containing screenshots of your program working for several test scenarios
covering the aforementioned functionality. If your program does not work properly, you need to
explain exactly what does not work from the test scenarios you performed.

https://capitol.instructure.com/courses/6298/assignments/88242 3/3

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy