Skip to content

"Guess My Number" is a fun number-guessing game using HTML, CSS, and JavaScript. Players guess a random number between 1 and 20, receiving hints if the guess is too high or low. The game tracks the score, records the high score, and includes a reset feature, with dynamic color changes for feedback based on the guess.

License

Notifications You must be signed in to change notification settings

Harikantsharmag/Game--Guess-my-number

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Game--Guess-my-number

Guess My Number

"Guess My Number" is a simple number-guessing game built using HTML, CSS, and JavaScript. The user tries to guess a randomly generated number between 1 and 20. The game provides hints if the guess is too high or low, keeps track of the score, and records the high score. Features include a reset functionality and dynamic color changes based on the user's guess.

Features

-Live Demo: https://codepen.io/harikantsharmag/pen/JjrWoaa?editors=0100

  • Random Number Generation: The game generates a random number between 1 and 20 at the start of each session.

  • Input Validation: Only numbers between 1 and 20 are accepted as valid guesses. Any out-of-range input triggers a validation message to ensure the game remains within its defined rules.

  • Dynamic Feedback: As the user guesses, the game provides feedback via text and color changes. Correct guesses turn the screen green, while incorrect guesses result in a red background.

  • Score Tracking: The score starts at 20 and decreases with each incorrect guess, motivating players to guess efficiently.

  • High Score System: The game saves and displays the highest score achieved during the session, encouraging players to improve their performance.

How to Play

  1. Start the game and guess a number between 1 and 20.
  2. The game will provide feedback if your guess is too high or too low.
  3. You can reset the game by clicking the "Again!" button at any time.
  4. Try to achieve the highest score possible!

Learning Outcomes

Building "Guess My Number" allowed me to deepen my understanding of how JavaScript interacts with the Document Object Model (DOM) and how web applications can respond dynamically to user actions. It helped me sharpen my problem-solving skills and understand game logic implementation.

Technologies Used

  • HTML
  • CSS
  • JavaScript

Setup Instructions

  1. Clone the repository:
    git clone https://github.com/yourusername/guess-my-number.git
  2. Open index.html in your web browser to play the game.

Feel free to explore, modify, and enhance the game! Contributions are welcome. This project is licensed under the MIT License - see the LICENSE file for details.

About

"Guess My Number" is a fun number-guessing game using HTML, CSS, and JavaScript. Players guess a random number between 1 and 20, receiving hints if the guess is too high or low. The game tracks the score, records the high score, and includes a reset feature, with dynamic color changes for feedback based on the guess.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published