/cs50x-2024

Primary LanguageJavaScript

Number Guessing Game

Welcome to my CS50x 2024 final project: the Number Guessing Game! This game has been meticulously crafted to offer an engaging and challenging experience, testing your numerical intuition and decision-making skills. Here’s a comprehensive overview of how the game operates and what you can expect.

Game Overview:

The Number Guessing Game is a fun and interactive way to challenge yourself with numerical puzzles. The game features three distinct difficulty levels: Easy, Medium, and Hard. Each difficulty level has its own unique set of rules and constraints, making the game accessible to both casual players and those seeking a more challenging experience.

Difficulty Levels:

Easy Mode: When you select Easy mode, the game will generate a random number between 1 and 10. In this mode, you have a total of 3 guesses to determine the correct number. The limited range and fewer guesses make this mode ideal for beginners or those looking for a quick and simple challenge.

Medium Mode: Opting for Medium mode increases the range of numbers to be guessed from 1 to 100. Here, you are given 5 guesses to figure out the correct number. This mode provides a moderate challenge, striking a balance between difficulty and playability.

Hard Mode: The Hard mode is designed for those who are looking for a more intense and prolonged guessing experience. In this mode, the game generates a number between 1 and 1000, and you have 10 guesses to find the right number. The expansive range and increased number of guesses make Hard mode the ultimate test of your guessing skills.

Gameplay Mechanics:

Guessing and Feedback: During the game, you will input your guesses into a text box. After entering a number, you click the "Submit Guess" button to check if your guess is correct. If you correctly guess the number within the allotted guesses, you will receive a congratulatory message: "Congratulations! You got it right!" This message celebrates your success and signifies that you have completed the game.

Game Over: If you exhaust all your guesses without arriving at the correct number, you will be presented with a "!!!GAME OVER!!!" message. This indicates that the game has ended and you have not succeeded in guessing the number within the given attempts.

Duplicate Guesses: To ensure a fair and engaging experience, the game checks for duplicate guesses. If you attempt to submit a number that you have already guessed, the system will alert you to this fact. It will prompt you with a warning that you have already made that guess and request that you enter a different number to proceed.

User Interface:

How To Play: On the left side of the game screen, there is a section titled "How To Play." This section provides a concise explanation of the game's rules and how to play. It serves as a helpful guide for new players, ensuring that you understand the gameplay mechanics and can start playing without any confusion.

Starting a New Game: Once the game ends, either by guessing the number correctly or running out of guesses, the "Start New Game" button becomes active. Clicking this button allows you to begin a new game session, with the difficulty level you initially selected. This feature provides a seamless way to continue playing and challenge yourself further.

Visual and Functional Design: The game has been designed with a user-friendly interface that combines HTML, CSS, and JavaScript. The visual design is clean and intuitive, ensuring that players can focus on the gameplay without being distracted by complicated controls. The code for the game is consolidated on a single page for practicality, making it easy to maintain and update.

Additional Notes:

The Number Guessing Game was developed using HTML for the structure, CSS for styling, and JavaScript for the interactive elements. This combination of technologies ensures that the game runs smoothly and provides a responsive user experience. Artificial intelligence applications were also utilized to enhance the functionality and ensure that the game operates as intended.

Enjoy the Game:

I hope you find the Number Guessing Game both enjoyable and challenging. Whether you’re testing your skills in Easy mode or pushing your limits in Hard mode, the game is designed to provide a rewarding experience. Good luck, and may your guesses be accurate!

Enjoy.

Rashko Enev Screenshot 2024-09-09 at 16 56 42