Dsa Report
Dsa Report
Report/Document
Project: “Hangman
Game”
Group Members Name:
Nimra (CS-216)
Hanan Saeed (CS-205)
Umer Jutt (CS-214)
Nauman (CS-212)
Introduction to Hangman game:
Hangman is a classic word-guessing game where one player thinks of a
word and the other player tries to guess it by suggesting letters one at a
time. The word is represented by a series of dashes, each dash
representing a letter in the word. With each incorrect guess, a part of a
gallows and a stick figure of a hanged man is drawn. The player must
guess the word before the stick figure is completed, or they lose. It's a fun
and challenging game that tests vocabulary and deductive skills.
1. Word Selection:
The game randomly selects a word from a predefined list of words or allows the
player to input a word for the opponent to guess.
2. Visual Representation:
Hangman typically includes a visual representation of the gallows and the
hanged man. This serves as a visual indicator of the player's progress and the
number of incorrect guesses allowed.
3. Letter Guessing:
Players guess letters one at a time to uncover the hidden word. The game
should provide feedback on whether the guessed letter is present in the word
and its position(s) if it is.
4. Limited Attempts:
Players have a limited number of incorrect guesses allowed before the hanged
man is complete. Once the figure is complete, the game ends, and the player
loses.
5. Scoring System:
The game includes a scoring system based on factors such as the number of
incorrect guesses, the length of the word, and the time taken to guess the word.
6. Word Categories:
To add variety and challenge, Hangman can include different word categories
such as animals, countries, movies, or any other thematic group.
7. Difficulty Levels:
The game may offer different difficulty levels, adjusting factors such as the
length of the word or the number of incorrect guesses allowed, to cater to
players of varying skill levels.
These features collectively make Hangman a popular and enjoyable game for
players of all ages.
2. Queue:
- Guess History: Queues can be used to maintain a history of guesses made
by the player. Each time a new letter is guessed, it can be enqueued, and if
needed, the oldest guess can be dequeued to limit the history size. This can be
useful for providing feedback to the player on their previous guesses.
3. Array:
- Word Representation: Arrays can efficiently represent the hidden word or
the letters guessed correctly so far. Each element of the array can correspond to
a letter in the word, allowing for easy indexing and updating as letters are
guessed.
- Random Word Selection: Arrays used to store a collection of words from
which the game randomly selects the word to be guessed. The array allows for
easy access to individual words and facilitates the random selection process.
Overall, the use of these data structures enhances the functionality and
organization of the Hangman game, making it more efficient, manageable, and
enjoyable for both players and developers.
Hanan Saeed
He has given the idea of what type of methods can be used in this game to
properly work. He properly explained the working of code in a written form
also, so that every member can visualize the game and work on its algorithms
without any confusion.
Nauman:
He has given the idea of how to design the hangman displayed parts and
also of setting the levels in the game.
Umer:
He has provided the list of guessed words to be categorized in the Easy,
Medium or hard level. He has told about time complexity of algorithms and also
about the randomly generated words to be guessed by the user.
Interface of the Game:
When User Guessed the word:
When the user unable to guess the word: