https://github.com/w-n-r/game-ict-final_project-
Powered by: WARAV ๐ฎ I have developed a number guessing game using the C++ programming language ๐ป. This project was created as part of a university assignment ๐, where the primary requirement was to utilize only the concepts of C++ without incorporating any advanced libraries or frameworks ๐ซ๐ฆ.
https://github.com/w-n-r/game-ict-final_project-
game game-development gamedev games number-generator number-guessing-game programming project project-management ramdom random-number-generators
Last synced: about 1 month ago
JSON representation
Powered by: WARAV ๐ฎ I have developed a number guessing game using the C++ programming language ๐ป. This project was created as part of a university assignment ๐, where the primary requirement was to utilize only the concepts of C++ without incorporating any advanced libraries or frameworks ๐ซ๐ฆ.
- Host: GitHub
- URL: https://github.com/w-n-r/game-ict-final_project-
- Owner: W-N-R
- License: mit
- Created: 2025-01-05T20:14:07.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-03-30T08:45:55.000Z (about 1 month ago)
- Last Synced: 2025-03-30T09:27:27.202Z (about 1 month ago)
- Topics: game, game-development, gamedev, games, number-generator, number-guessing-game, programming, project, project-management, ramdom, random-number-generators
- Language: C++
- Homepage: https://github.com/W-N-R/GAME-ICT-final_project-/tree/main
- Size: 2.61 MB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Number Guessing game
Powered by: WARAV
๐ฎ I have developed a number guessing game using the C++ programming language ๐ป. This project was created as part of a university assignment ๐, where the primary requirement was to utilize only the basic concepts of C++ without incorporating any advanced libraries or frameworks ๐ซ๐ฆ. As a result, the game does not include any graphical elements ๐จ๐ผ๏ธ since I was not permitted to use libraries like SFML or similar tools to enhance the visuals.
๐ข The game is designed to focus purely on logic ๐ง and functionality โ๏ธ, showcasing my understanding of fundamental programming concepts such as loops ๐, conditional statements โโ , functions ๐, and random number generation ๐ฒ๐ข. Despite the absence of advanced graphics, the game offers an engaging and interactive experience ๐๐น๏ธ by challenging users to guess a randomly generated number within a specified range.
๐ก This project not only highlights my proficiency in C++ ๐ป๐ but also demonstrates my ability to work within constraints ๐งฑ and deliver functional results โ ๐ฅ. It serves as an excellent example of how creativity ๐ and problem-solving ๐ ๏ธ can be applied to develop an enjoyable game, even with limited resources.
โจ Iโm thrilled to explore more opportunities ๐๐ช to enhance my programming skills and create even more dynamic, visually appealing projects in the future! ๐๐
*********Introduction:
Creating simple interactive games happens to be one of the most effective ways in the field of computer programming for developers, especially beginners, to understand basic programming concepts. This report outlines the development process of a number-choosing game implemented in C++. The player is supposed to guess a number that is randomly generated within a defined range.This game will enhance the understanding of some very important programming principles such as:
1. Loops **(while, for, do while)**
2. Conditionals **(if, else, switch case, statements)**
3. Random number generation **(rand, s rand & use of new library (cstdlib) )**
4. Even input validation.
5. Additionally, this will build Problem-solving skills
6. Provide an interface for anybody who may be interested in something that is not only fun but educational too.This game is therefore not just about having a tool that has practical hands-on experience of C++ basic aspects but fun for new developers such as me. This project is a great example of how interactive software can be developed using core programming constructs. Throughout the process of development, extra care was taken to ensure the game plays intuitively and responds quickly,
being simple with code structure, i.e. usage of **(if, else statements)** only as conditions.
***************************************
Problem analysis
A good number-guessing game needs quite a few steps for fluid gameplay as well as robust error handling. Here are the key problems that were encountered in this regard:1. Mechanism To Take Difficulty Level Of Game From User:
The first challenge is to design the system, where the game takes input of user that what kind of difficulty level he or she want to play. In interactive games, taking the difficulty level input from the user is a crucial step to ensure personalized gameplay. The mechanism involves presenting the user with predefined difficulty levels **(e.g., Easy, Medium, Hard)** at the start of the game. This input can be collected using simple methods such as menu selection or text-based input.
**getline(cin, level)** is used here, this is because when function such as string I called in my programing code then then it just takes the only one complete word note the whole line .
For example: if I enter my name such as Muhammad Waleed, then without using getline it just takes Muhammad only, not the complete line so thatโs why I used getline command to take the whole line.2. Random Number Generation:
To generate a number a number between a given range is another challenging step. In C++, this has been accomplished using the rand() function in such a way that for each iteration, it will offer a new number to guess for. To make this I have to include a library named:#include-cstdlib- & #include-ctime-
The player must enter their guess through the console. Input should be validated to ensure that it is a number and falls within the defined range. Non-numeric input should be handled carefully to avoid crashes or unexpected behavior.
*************************************
3. Game Logic:
The game must check if the guess of the player is correct, too high, or too low. In case of an incorrect guess, the program should provide feedback and ask the player to guess again.
4. Feedback Mechanism:
The effective feedback loop must be established in the game so that the player gets guided through the process. It should give the player feedback that the guess is too high or too low and display the number of attempts taken to guess correctly.
5. End Conditions:
The game should be closed when either the correct number is guessed or exceeded several allowed guesses. When the player fails to guess the number before the set limit, the game should include the right number in the messages.
********************
Design Requirement
For the game to meet user and technical expectations and work efficiently, several key design requirements were defined:1. Functional Requirements:
a. The game produces a random number between some predefined range, such as (1 to 100).
b. The player inputs his or her guess using the keyboard.
c. The game compares the guess against the generated number and provides feedback, such as "Way Far", "Still Away", or "Almost There!!"
d. The game tracks the count of guesses and allows the player to retry for the correct number till he exhausts his attempts.2. Non-Functional Requirements:
a. Performance: The game must be able to run without a delay. Input handling and feedback must be immediate, with no perceived lag or system slowdown.
b. Reliability: The game should be robust, in that it must be able to handle different kinds of incorrect input, such as non-numeric values or inputs outside the acceptable range, without crashing.
c. Usability: The game should be easy to learn and play. The interface could be text-based but should have clarity and conciseness for simple technical knowledge among players.
************************
Fesibility analysis:
1. Technical Feasibility:
The game has been developed using **C++** that provides all the tools required to complete the tasks. **C++** has a very rich standard library such as cstdlib , cmath ,with functions like **rand() & sqrt(), pow()** for generating random numbers and handling input/output via cin and cout. The project uses basic programming constructs like loops, conditionals, and simple input/output operations that make it feasible for a beginner to understand and modify it.

*********************
1. Initialization:
Welcome message along with the reference of creators

*****************2. Game Loop:

Ask the player to guess the number.
If the guess is too high, display "Way Far"
If the guess is too low, display "Coming closer"
If the guess is correct, display "Congratulations! You guessed the number!"
Continue until the player guesses the number or runs out of attempts.
*********************CONCLUSION
In conclusion, the creation of the number-guessing game in C++ has served as an excellent opportunity to solidify fundamental programming concepts. The key insights gained from this project include:
โขMastery of Core Programming Concepts:
Developing the game provided hands-on experience with essential programming elements, such as:
1.Loops
(while, for, do-while)
2.Conditional Statements
(if, else, switch-case)
3.Random Number Generation
(using rand, srand, and the cstdlib library)
4.Input Validation
5.Enhancing Problem-Solving Abilities
โข **Interactive and Educational Experience:**
The game not only provides an engaging and fun experience but also serves as an educational tool for anyone eager to explore programming through interactive software.โข **Practical Application of C++ Fundamentals:**
This project was a hands-on way to implement basic C++ concepts, demonstrating how foundational programming techniques can be applied to create an interactive and user-friendly game.โข **Simple and Intuitive Design:**
Throughout the development process, special attention was given to creating a game that is easy to understand and responsive, with a straightforward code structure centered around if-else statements for logical decision-making.โข The number-choosing game developed in C++ is a simple yet effective tool for learning the basic concepts of programming. It combines essential programming techniques such as loops, conditionals, and random number generation, offering an interactive and educational experience. With further enhancements, such as multiplayer modes and graphical interfaces, this game could evolve into a more complex and enjoyable experience.
________________________________________
**In summary**, this project illustrates how fundamental programming skills can be used to create both an enjoyable and educational tool, benefiting new developers and those learning the basics of C++ programming.
copyrights ยฉ 2025 MUHAMMAD WALEED | All rights reserved