0% found this document useful (0 votes)
16 views5 pages

PF Term Project

Uploaded by

Tehrim 2517
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)
16 views5 pages

PF Term Project

Uploaded by

Tehrim 2517
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/ 5

PF Term Project

Punjab University College of


Information Technology

PF-Special-Section

CC-112L

Programming Fundamentals

Ma’am Azka Saddiqa

Page 0 of 4
Programming Fundamentals (CC-112L )

Instructor: Ma’am Azka Saddiqa

Instructions:
• This is an individual assignment. Absolutely NO collaboration is allowed. Any traces of
plagiarism/cheating would result in an “F” grade in this course.
• Do NOT copy even a single line of code from any other person or book or Internet or any other source.
• You have to complete this Project Tasks within the Deadline. Late submission will result in 0 Marks.

DEADLINE: 18 June, 2024 11 : 59 PM

Project Title:
Hangman Game with User Registration and Game Record
Storage

Hangman Game Explanation:


Hangman is a classic word-guessing game. Here's how it works:
1. Setup: One person thinks of a word and keeps it secret. They draw a series of dashes,
each representing a letter in the word. For example, if the word is "apple," they would
draw "_ _ _ _ _".
2. Guessing: The other player starts guessing letters one by one. If the guessed letter is in
the word, the person who thought of the word reveals all occurrences of that letter in the
word. If the guessed letter is not in the word, the person draws part of a hangman
(usually a stick figure) on the gallows.
3. Completing the Word or Losing: The guessing continues until either:
o The entire word is guessed correctly.
o The hangman drawing is complete, indicating that the guessing player has run out
of guesses.
4. Winning or Losing: If the word is guessed correctly before the hangman is fully drawn, the
guessing player wins. If the hangman is fully drawn before the word is guessed, the player
who thought of the word wins.
Remember, the person guessing should try to pick letters they think are likely to be in the word
based on common words and letter frequencies.

Page 1 of 4
Project Instructions:
You are tasked with developing a Hangman game in C++ with additional features including user
registration and login functionality, as well as storing game records in a file. The game should utilize file
handling for user data and game records. The score for each game should be calculated based on the
number of tries the player took to guess the word.

Requirements:
1. User Registration and Login:
o Users should be able to register with a unique username and password.

o Existing users should be able to log in with their username and password.

o User registration information should be stored in a file named "users.txt".

o The users.txt should look like this:

2. Gameplay:
o The game should be implemented using the Hangman concept.

o The game should choose a random word from a predefined list of words stored in a file
named "words.txt".

o The words.txt should look like this:

o The player should be able to guess letters to uncover the secret word.

o The player should have a maximum number of tries equals to 6 to guess the word.

o The game should display the current state of the guessed word after each guess.

o If the player guesses all the letters correctly within the maximum number of tries, they
win the game. Otherwise, they lose.
Page 2 of 4
3. Scoring:

o The score for each game should be calculated based on the number of tries the player
took to guess the word.

o The score can be calculated as the difference between the maximum number of tries and
the actual number of tries taken by the player.

o Example1: If user guessed the word in 4 tries out of 6 then the score is 2.

o Example 2: If user guessed the word in 2 tries then the score is 4.

o Higher scores indicate better performance (i.e., fewer tries).

4. Game Record Storage:

o After each game, the game record should be stored in a file named "game_records.txt".

o The game_records.txt Should look like this:

o Each game record should include the following information:

▪ Username of the player

▪ Whether the player won or lost the game

▪ The score achieved in the game

Guidelines:

1. File Handling:

o Use file handling operations to read/write user registration data, word list, and game
records. Make sure to open the file in the mode that suites the functionality described in
above requirements.

o Ensure error handling for file operations (e.g., file not found, permission issues).

2. Modular Programming:

o Implement the game functionalities using modular programming approach.

o Divide the code into appropriate functions for user registration, login, gameplay, scoring,
and file handling.

Page 3 of 4
3. User Interface:

o Design a user-friendly interface (Well Formatted Console Game) for registration, login, and
gameplay.

o Clearly display game instructions, user prompts, and game outcomes.

o After each game user will be given options to quit or play again. If user wants to play
again the clear the console and restart the game. If user quits then the program should
end.

4. Error Handling:

o Implement robust error handling mechanisms for user inputs and file operations.

o Provide informative error messages for users in case of invalid inputs or file-related errors.

5. Code Documentation:

o Document the code thoroughly using comments to explain the purpose of each function,
variable, and code block.

o Follow a consistent naming convention for variables, functions, and files.

6. Testing:

o Test the program extensively to ensure all functionalities work as expected.

o Perform both positive and negative testing scenarios to validate user registration, login,
gameplay, and file handling functionalities.

7. Submission:

o Submit the project source code files along with necessary input files (e.g., words.txt,
users.txt) and output files (e.g., game_records.txt).

o Include a README file (ReadMe.txt) with instructions on how to compile and run the
program, as well as any additional information about the project.

o Zip all above files in a folder and name it “BSEF23M001-PROJECT”. Submit this Zip
File on google Classroom.

Additional Notes:

• Code Optimization: Optimize the code for efficiency and readability, while avoiding unnecessary
complexity.

By following these requirements and guidelines, you can create a comprehensive and well-structured
Hangman game project with user registration and game record storage functionality. For any Query refer
to your Book. Do this project yourself because a tough viva will be taken for this Project Evaluation and
any traces of Cheating will result in 0 Marks.

BEST OF LUCK
Page 4 of 4

You might also like