0% found this document useful (0 votes)
18 views

01 134231 043 106158104668 19062023 012116am

This document provides an overview of a project to develop a console-based implementation of the classic Hangman game using C++. The project will include choosing words from different difficulty levels, displaying the game status, tracking guesses, and scoring. It outlines the scope, team roles, project plan, system design, intended audience, and functional requirements. The team consists of three members with defined responsibilities, and the plan includes tasks over six weeks for planning, design, development, testing and delivery.

Uploaded by

stife benz
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)
18 views

01 134231 043 106158104668 19062023 012116am

This document provides an overview of a project to develop a console-based implementation of the classic Hangman game using C++. The project will include choosing words from different difficulty levels, displaying the game status, tracking guesses, and scoring. It outlines the scope, team roles, project plan, system design, intended audience, and functional requirements. The team consists of three members with defined responsibilities, and the plan includes tasks over six weeks for planning, design, development, testing and delivery.

Uploaded by

stife benz
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/ 20

Table of Contents:

1. Scope of the Project


1.1 Justifications

1.2 Boundary of the Project

2. Team
2.1 Team Members
2.2 Responsibilities

3. Project Management
3.1 Project planning and scheduling

3.1 Project Plan

3.3 Schedule Representation

4. System design 5. Intended Audience of


our Project
5.1 Stakeholders

6. Role Playing (among team members) 7


Functional Requirements
7.1 Game Mechanics

7.2 User Interface

7.3 Difficulty Levels

8. Requirement Specification
8.1 Introduction

8.2 Hardware Requirements

8.3 Hardware Requirements for Present Project

8.4 Software Requirements for Present Project

9. Conclusion

Project Application Idea:


The Hangman game is a
classic word-guessing game that has been around for centuries. The game involves
guessing a word by suggesting letters one at a time. The objective of this project is to
develop a console-based implementation of the Hangman game using C++. The game
will allow the user to play the game by guessing letters and displaying the result on
the screen. The game will have a predefined set of words, and the user can choose
the difficulty level to play.

Introduction:
The Hangman Game: A Captivating Challenge of Words!
The Hangman Game is a computer programming project that brings the classic
wordguessing game to life. In this engaging and interactive game, players are tasked
with unraveling hidden words by guessing individual letters. The objective is to
discover the correct letters and complete the word before a hangman is fully drawn,
ultimately challenging players' vocabulary and deductive skills. With its simple yet
addictive gameplay, the Hangman Game offers an exciting opportunity to entertain
and engage users while expanding their knowledge of words. This report will delve
into the development process, features, and functionalities of the Hangman Game,
highlighting its significance as an entertaining and educational computer game.

1. Scope of the Project:


1. Create a console-based game that enables users to play Hangman.
2. Put the game's logic into action, which entails choosing a word from a list of
predetermined terms and showing the outcome on the screen.
3. Allow the user to choose the difficulty level, which will determine the length of the word
to guess.
4. Implement the scoring system, which will calculate the score based on the number of
attempts made to guess the word.
5. Implement error handling to guarantee that users provide accurate information.
6. Give the player hints to aid them.
1.1. Justifications:
The implementation of the Hangman game in C++
will provide the user an enjoyable experience and the user will have a fun time
playing the Hangman game thanks to the C++ implementation. The advantage of
speedier execution makes C++, a well-liked programming language for game
creation, the best option for creating console-based games. Furthermore, C++ permits
low-level memory manipulation, enabling performance optimization for the game.

1.2. Boundary of the Project:


The project will be developed using the
C++ programming language, and it will be a console-based game. The game will
have a predefined set of words, and the user can choose the difficulty level to play.
The game will have a single player and multiplayer option.

2. Team:
2.1. Team Members:
The project team will consist of three members:
• Muhammad Abdullah Azib 01-134231-043
• Muhammad Abdullah Masood 01-134231-044
• Muhammad Zohaib 01-134231-070

2.2. Responsibilities:
The responsibilities of each team member are as follows:

1. Project Manager: Manage the project, create the project plan, and coordinate
the activities of team members.
2. Developer: Develop and implement the game logic, and optimize the game's
performance.
Tester: Test the game to ensure that it is free of errors and provides an enjoyable
gaming experience.

3. Project Management:
3.1. Project planning and scheduling:
Project planning
and scheduling were crucial for the successful completion of the Hangman Game
project. A detailed project plan was created, outlining the tasks, milestones, and
timelines for each development phase. This helped in allocating resources effectively
and ensuring that the project progressed smoothly. A Gantt chart was utilized to
visualize the project timeline, monitor progress, and manage dependencies. Regular
team meetings and progress updates ensured effective communication and coordination
among team members.

3.2. Project Plan:

The project plan is as follows:


Week 1: Research and analyze the requirements of the project.
Week 2: Develop the game logic that can select a word from a predefined set of
words and display the result on the screen.

Week 3: Implement the game logic that allows the user to guess letters and displays the
result on the screen.

Week 4: Implement the scoring system, error handling, multiplayer game, and hints
to help the player.

Week 5: Test and debug the game to ensure that it is free of errors and provides an
enjoyable gaming experience.

Week 6: Document the project and submit the final report.

3.3 Schedule Representation:


Scheduling the project tasks is an
important project planning activity. It involves deciding when and which tasks would
be taken up.
Week 1 2 3 4 5 6
Planning
Design
Coding
Testing
Delivery

4. System Design:

4.1 Introduction:
The system design for the Hangman Game encompasses the overall architecture and
design considerations. The game follows a client-server architecture, where the client
represents the user interface and the server manages the game logic. The design
prioritizes simplicity, user-friendliness, and scalability to accommodate potential
future enhancements. The Hangman Game was developed using an object-oriented
design approach, ensuring modularity and ease of maintenance.

4.2 Implementation:
The implementation of the Hangman Game in C++ involved the use of objectoriented
programming principles to create classes such as HangmanGame and
WordGenerator. The game logic was built around these classes, allowing for word
selection, letter guessing, and scoring. The program utilized standard input/output
streams for user interaction and displayed the hangman figure and partially revealed
word using ASCII art and string manipulation techniques. Error handling
mechanisms were implemented to validate user input and provide appropriate
feedback. Difficulty levels were incorporated, adjusting the word selection based on
the chosen level. Testing and debugging played a vital role in ensuring a bug-free and
enjoyable gaming experience. Overall, the implementation successfully delivered a
captivating and interactive Hangman Game in C++.
Screenshots:

Fig:1:Start of the game.

Fig:2:Gameplay.
Fig:4: Lose screen.

Fig:4: Win screen.


4.3 Diagram / Flowchart of Hangman Game:
5. Intended Audience of our Project:
The intended audience for this project includes children, young adults, adults, the
game development community, educators, and casual gamers. The project will
provide a fun and educational way for players to improve their vocabulary skills and
cognitive abilities while enjoying a classic game.
Overall, the intended audience for this project is anyone who wants to have fun while
improving their vocabulary skills and cognitive abilities, regardless of their age or
background.

5.1. Stakeholders:
The stakeholders involved in the Hangman Game
project include the project team, end-users, and potential clients or sponsors. The
project team consists of developers, designers, and testers who collaborated to bring
the game to life. The end-users are the players who will interact with and enjoy the
Hangman Game. Client or sponsor involvement was limited to providing guidance
and feedback throughout the development process.

The stakeholders for this project are:


1. The end-users: People who will play the game.
2. The project team: Consisting of the project manager, developer, and tester.
3. The project sponsors: Any organization or individuals who are funding the project.
4. The game development community: People who are interested in game development
and may use this project as a reference for their work

6. Role playing (among team members):


One member of the group will be responsible for managing the project and
coordinating the activities of team members. The next member of the group will be
responsible for developing

and implementing the game logic. The third and the last group member will be
responsible for testing the game to ensure that it is free of errors and provides an
enjoyable gaming experience.
7. Functional Requirements (5):
1. The game must display a set of blank spaces on the screen representing the letters
in the words to be guessed.
2. The user must be able to guess one letter at a time.
3. The game must display the letters that the user has guessed and the remaining
attempts.
4. The game must randomly select a word from a predefined set of words.
5. The game must provide the user with an option to choose the difficulty level.

These functional requirements are essential for the proper functioning of the game
and must be implemented.

7.1 Game Mechanics:


The Hangman Game follows the traditional rules of the
classic game. Players attempt to guess a word by suggesting letters one at a time. For
each incorrect guess, a part of the hangman's body is drawn. The player wins if they
correctly guess the word before the hangman is completed. The game tracks the
number of incorrect guesses and updates the hangman figure accordingly.

7.2 User Interface:


The user interface of the Hangman Game is designed to be
intuitive and user-friendly. Players are presented with a graphical interface that
displays the hangman figure, the letters guessed, and the partially revealed word. The
interface allows players to input their guesses through a keyboard or touchscreen.
Visual cues and animations enhance the gameplay experience and provide feedback
to the player.

7.3 Difficulty Levels:


The Hangman Game offers multiple difficulty levels to
cater to different player preferences. The difficulty levels include easy, medium, and
hard. In the easy level, commonly used words with fewer letters are selected.
Medium-level words offer a moderate challenge, while hard-level words pose a
higher level of difficulty. The choice of difficulty level impacts the complexity and
length of the words to be guessed.
8. Requirement Specification:
8.1 Introduction:
The requirement specification section outlines the
specific hardware and software requirements for the Hangman Game project. These
requirements define the necessary components and environment needed to run the
game successfully. This section ensures that the project team and stakeholders have
a clear understanding of the infrastructure needed to support the Hangman Game.

8.2 Hardware Requirements:


The hardware requirements for the
Hangman Game are minimal. The game can be run on standard personal computers or
mobile devices that meet the basic system requirements. These include a functioning
processor, sufficient memory, and an input device such as a keyboard or touchscreen.

8.3 Hardware Requirements for Present Project:

Processor: Intel Core i5 to Intel Core i7 8th generation used as a processor because it
provides reliable and stable working and run our pc for long time.

Ram: Ram 4 GB up to 16 GB is used, as it will provide fast calculations and performance.

Hard Disk: Hard disk from 80 GB up to 1 TB is used.

8.4 Software Requirements for Present Project:


The software requirements for the present project include a programming language
and any specific libraries or frameworks necessary for the implementation of the
Hangman Game. The game was developed using [Programming Language] and
utilizes the [Library/Framework] for [specific functionality]. Users will also need an
operating system that supports the chosen programming language.

Operating System: Window 7, 10 is used as OS as it is stable and supports more features.

Development Tools: C++ support Visual Studio provided by Microsoft is used as


it provides stable working.

9. Conclusion:
In conclusion, the Hangman Game project has been
successfully developed, meeting the specified requirements and objectives. Through
effective project management, meticulous planning, and a well-designed system, the
team was able to create an engaging and enjoyable game. The game mechanics, user
interface, and difficulty levels provide a satisfying experience for players. Further
enhancements and improvements can be explored to expand the game's features and
reach a wider audience. Overall, the Hangman Game project was a valuable learning
experience, showcasing the team's programming skills and project management
capabilities.
Code:

#include <iostream>
#include <cstdlib>
#include<vector>
#include <ctime>

using namespace std;

string chooseWord(int level)


{

string easyWords[] = { "sword", "ankle", "bride", "month", "coach","learn" };


string mediumWords[] = { "collect", "scandal", "diamond", "quarrel", "hallway","advance" };
string hardWords[] = { "university", "xylophone", "copyright", "python",
"expansion","clearance" };

int numWords;
string* wordArray;

switch (level) {
case 1:
numWords = sizeof(easyWords) / sizeof(easyWords[0]);
wordArray = easyWords;
break;
case 2:
numWords = sizeof(mediumWords) / sizeof(mediumWords[0]);
wordArray = mediumWords;
break;
case 3:
numWords = sizeof(hardWords) / sizeof(hardWords[0]);
wordArray = hardWords;
break;
default:
cout << "Invalid level. Setting to easy." << endl;
numWords = sizeof(easyWords) / sizeof(easyWords[0]);
wordArray = easyWords;
break;
}

srand(time(0));
int Index = rand() % numWords;
string word = wordArray[Index];

return word;

}
void welcome() {
cout << "\033[1;31m";
cout << " _ _
\n";
cout << " | | | |
\n";
cout << " | |__| | __ _ _ __ __ _ _ __ ___ __ _ _ __
\n";
cout << " | __ |/ ` | ' \\ / ` | ' ` _ \\ / ` | ' \\ \n";
cout << " | | | | (_| | | | | (_| | | | | | | (_| | | | |
\n";
cout << " |_| |_|\\__,_|_| |_|\\__, |_| |_| |_|\\__,_|_| |_|
\n";
cout << " _/ |
\n";
cout << " |___/
\n";

cout << "\n Welcome to the Hangman Game!\n\n";


cout << "\033[0m";
}

string Guess(string word)


{
string guess(word.length(), '_');

return guess;
}
void misse(int misses)
{
if (misses == 1)
{

cout << " +-------------------+ \n";


cout << " | | \n";
cout << " | | \n";
cout << " | | \n";
cout << " | \n";
cout << " | \n";
cout << " | \n";
cout << " | \n";
cout << " | \n";
cout << " | \n";
cout << " | \n";
cout << " | \n";
cout << " ====================== \n";

}
else if (misses == 2)
{

cout << " +-------------------+ \n";


cout << " | | \n";
cout << " | | \n";
cout << " | | \n";
cout << " (-_-) | \n";
cout << " | \n";
cout << " | \n";
cout << " | \n";
cout << " | \n";
cout << " | \n";
cout << " | \n";
cout << " | \n";
cout << " | \n";
cout << " | \n";
cout << " ====================== \n";

}
else if (misses == 3)
{

cout << " +-------------------+ \n";


cout << " | | \n";
cout << " | | \n";
cout << " | | \n";
cout << " (-_-) | \n";
cout << " | | \n";
cout << " | | \n";
cout << " | | \n";
cout << " | \n";
cout << " | \n";
cout << " | \n";
cout << " | \n";
cout << " | \n";
cout << " | \n";
cout << " ====================== \n";

}
else if (misses == 4)
{

cout << " +-------------------+ \n";


cout << " | | \n";
cout << " | | \n";
cout << " | | \n";
cout << " (-_-) | \n";
cout << " | | \n";
cout << " |\\ | \n";
cout << " | \\ | \n";
cout << " | \n";
cout << " | \n";
cout << " | \n";
cout << " | \n";
cout << " | \n";
cout << " | \n";
cout << " ====================== \n";

}
else if (misses == 5)
{

cout << " +-------------------+\n";


cout << " | |\n";
cout << " | |\n";
cout << " | |\n";
cout << " (-_-) |\n";
cout << " | |\n";
cout << " /|\\ |\n";
cout << " / | \\ |\n";
cout << " |\n";
cout << " |\n";
cout << " |\n";
cout << " |\n";
cout << " |\n";
cout << " |\n";
cout << " ======================\n";

}
else if (misses == 6)
{

cout << " +--------------------+\n";


cout << " | | \n";
cout << " | | \n";
cout << " | | \n";
cout << " (-_-) | \n";
cout << " | | \n";
cout << " /|\\ | \n";
cout << " / | \\ | \n";
cout << " | | \n";
cout << " | | \n";
cout << " / | \n";
cout << " / | \n";
cout << " | \n";
cout << " | \n";
cout << " ====================== \n";

}
void status(vector<char>incorrect, string guessword)
{

cout << "Incorrect Guesses: \n";

for (int i = 0; i < incorrect.size(); i++)


{
cout << incorrect[i] << " ";
}

cout << "\nWord:\n";

for (int i = 0; i < guessword.length(); i++)


{
cout << guessword[i] << " ";
}
}
void end_game(string guessword, string word)
{

if (guessword == word)
{
//cout << "\033[1;33m";
system("color 05");
cout << " Hooray! You won\n";
//cout << "
Congratulations!\n";
cout << " ,. ,. ,.\n";
cout << " || || || ()\n";
cout << " ,--. ,-. ,.,-. ,--.,.,-. ,-. ||-.,. ,.|| ,-. ||-.,. ,-. ,.,-. ,--.\n";
cout << "//`-'//-\\\\||/|| //-||||/`'//-\\\\ ||-'|| ||||//-\\\\ ||-'||//-\\\\||/||
((`-'\n";
cout << "|| || |||| |||| |||| || || || || /|||||| || || |||| |||| || ``.\n";
cout << "\\\\,-.\\\\-//|| || \\\\-.|||| \\\\-|| || ||//||||\\\\-|| || ||\\\\-//||
|| ,-.))\n";
cout << " `--' `-' `' `' `-,|`' `-^-``' `-' `'`' `-^-``' `' `-' `' `' `--'\n";
cout << " // .--------.\n";
cout << " ,-.// .: : : :___`.\n";
cout << " `--' .'!!::::: \\\\\\_ `.\n";
cout << " : . /%O!!::::::::\\\\_\\. \\\n";
cout << " [\"\"]/%%O!!::::::::: : . \\\n";
cout << " | |%%OO!!::::::::::: : . |\n";
cout << " | |%%OO!!::::::::::::: :|\n";
cout << " : .'--`.%%OO!!:::::::::::: :|\n";
cout << " : .: /`.__.'\\%%OO!!::::::::::::/\n";
cout << " : . / \\%OO!!!!::::::::::/\n";
cout << " ,-'``'-. ; ;%%OO!!!!!!:::::'\n";
cout << " |`-..-'| | ,--. |`%%%OO!!!!!!:'\n";
cout << " | . :| |_.','`.`._| `%%%OO!%%'\n";
cout << " | . : | |--' `--| `%%%%'\n";
cout << " |`-..-'| || | | | | /__\\`-.\n";
cout << " \\::::::/ ||)|/|)|)|\\| /\n";
cout << "---------`::::'--|._ ~**~ _.|----------( -----------------------\n";
cout << " )( | `-..-' | \\ ______\n";
cout << " )( | |,--. ____/ / /\\\\ ,-._.-'\n";
cout << " ,-')('-. | |\\`;/ .-()___ : |`.!,-'`'/`-._\n";
cout << " ( ' ` )`-._ _.-'|;,| `-, \\_\\__\\`,-'>-.,-._\n";
cout << " `-....-' ```` `--' `-._ (`- `-._`-. 5\n";
//cout << "\033[0m";
}
else
{
system("color 04");
//cout << "\033[1;31m";
cout << " +-------------------+ \n";
cout << " | | \n";
cout << " | | \n";
cout << " | | \n";
cout << " (-_-) | \n";
cout << " | | \n";
cout << " /|\\ | \n";
cout << " / | \\ |\n";
cout << " | | \n";
cout << " | | \n";
cout << " / \\ | \n";
cout << " / \\ | \n";
cout << " | \n";
cout << " | \n";
cout << " ====================== \n";
cout << "\n\n\n";

cout << " __ __ _ __"


<< endl;
cout << " \\ \\ / /__ _ _ | | ___ ___ ___ _ /
/" << endl;
cout << " \\ V / _ \\| | | | | |/ _ \\/ __|/ _ \\ (_)
|" << endl;
cout << " | | () | |_| | | | (_) \\_ \\ __/ _| |"
<< endl;
cout << " |_|\\___/ \\__,_| |_|\\___/|___/\\___| (_)
|" << endl;
cout << "
\\_\\" << endl;

cout << "\n\n";


cout << " On no! you lost \n";
cout << " Guess word was: " << word;
cout << "\n\n\n";

// cout << "\033[0m";


}
}

int main() {

int level;
int misses = 0;
char letter;
vector<char>incorrect;

welcome();

cout << " Choose Level


";
cout << endl;
cout << " 1.Easy
";
cout << endl;
cout << " 2.Medium
";
cout << endl;
cout << " 3.Hard
";
cout << endl;

cin >> level;

string word = chooseWord(level);

string guessword = Guess(word);

bool guess = false;


while (guessword != word && misses < 7)
{
system("color 40");
int i = 7;
cout << "you have " << -(misses - i--) << " tries left";
cout << endl;
cout << endl;
misse(misses);

status(incorrect, guessword);

cout << "\n\nPlease enter your guess: ";


cin >> letter;

for (int i = 0; i < word.length(); i++)


{
if (letter == word[i])
{
guessword[i] = letter;
guess = true;
}
}
if (guess)
{
cout << "\nCorrect!\n";
}
else
{
cout << "\nIncorrect!\n";

incorrect.push_back(letter);
misses++;
}
guess = false;
}
end_game(guessword, word);

return 0;
}

You might also like