npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@pedrocxz_/number-guessing-game

v1.0.1

Published

Welcome to the **Number Guessing Game**! This is a command-line game where you try to guess a randomly generated number between 1 and 100. Test your guessing skills and challenge yourself by selecting different difficulty levels.

Downloads

2

Readme

Number Guessing Game

Welcome to the Number Guessing Game! This is a command-line game where you try to guess a randomly generated number between 1 and 100. Test your guessing skills and challenge yourself by selecting different difficulty levels.


How to Play

  1. package installation
    npm i @pedrocxz_/number-guessing-game
  2. Run the game using the command:
    node index.js or game
  3. A random number between 1 and 100 will be generated for you to guess.
  4. You will be presented with a difficulty menu:
    • Easy: 10 chances to guess.
    • Medium: 5 chances to guess.
    • Hard: 3 chances to guess.
  5. Enter your guesses one at a time.
  6. After each guess, you'll receive a hint:
    • If your guess is too high, you'll see: Incorrect! The number is less than [your guess].
    • If your guess is too low, you'll see: Incorrect! The number is greater than [your guess].
  7. Keep guessing until you either find the correct number or run out of attempts.
  8. At the end of the game, you'll be asked if you want to play again. Enter y for yes or n for no.

Features

  • Random Number Generation: The game generates a new random number for every session.
  • Difficulty Levels: Choose from Easy, Medium, or Hard modes.
  • Hint System: Receive feedback to help you narrow down your guesses.
  • Play Again Option: Easily restart the game without re-running the script.
  • Input Validation: Handles invalid inputs gracefully, ensuring a smooth experience.

Example Gameplay

Welcome to the Number Guessing Game!
I'm thinking of a number between 1 and 100.

Please select the difficulty level:
1. Easy (10 chances)
2. Medium (5 chances)
3. Hard (3 chances)

Enter your choice: 2

Enter your guess: 50
Incorrect! The number is greater than 50.

Enter your guess: 75
Incorrect! The number is less than 75.

Enter your guess: 60
Congratulations! You guessed the correct number in 3 attempts.

Wanna play again? (y/n): n
Thanks for playing!

Requirements

  • Node.js (v16 or higher)

Setup and Installation

  1. Clone the repository or copy the index.js file into your project directory.
  2. Ensure you have Node.js installed.
  3. Run the game:
    game or node index.js

Customization

Feel free to modify the game to suit your preferences:

  • Change the Range: Update the generateRandom function to generate numbers in a different range.
  • Add More Difficulty Levels: Extend the menu to include more options with varying attempts.
  • Enhance Feedback: Customize the hints or add more detailed messages.

License

This game is open-source and available for educational and personal use. Feel free to modify and share it.


Enjoy playing the Number Guessing Game! If you have any feedback or suggestions, feel free to share!