Skip to content

tbalbini/gnumber-game1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Number Guessing Game

A simple command-line game where you try to guess a random number between 1 and 100.

Description

This is a fun and interactive number guessing game built with Node.js. The computer will randomly select a number between 1 and 100, and your task is to guess it correctly within the allowed number of attempts based on the difficulty level you choose.

Features

  • Three difficulty levels:
    • Easy: 10 attempts
    • Medium: 5 attempts
    • Hard: 3 attempts
  • Feedback after each guess to help you narrow down the correct number
  • Remaining attempts counter
  • Command-line interface for easy interaction

Installation

  1. Make sure you have Node.js installed on your system
  2. Clone this repository or download the files
  3. Navigate to the project directory
  4. Install dependencies:
npm install
  1. Make the file executable (optional, for Unix/Linux/Mac):
chmod +x index.js

Usage

You can run the game in two ways:

Using npm

npm start

Direct execution

node index.js

As a global command (after installing globally)

First, install the package globally:

npm install -g .

Then you can run it from anywhere:

gnumber-game1

How to Play

  1. Start the game using one of the methods above
  2. Select a difficulty level (1, 2, or 3)
  3. Enter your guess when prompted
  4. The game will tell you if your guess is too high or too low
  5. Keep guessing until you find the correct number or run out of attempts

Dependencies

  • prompt-sync: ^4.2.0 - For synchronous command-line input

License

ISC

Author

roadmap.sh: https://roadmap.sh/projects/number-guessing-game

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors