Skip to content

A colorful terminal-based number guessing game in Node.js with TypeScript

License

Notifications You must be signed in to change notification settings

waikoo/guess-my-number

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Guess My Number

Guess my number This is my version of the number guessing game seen in The Rust Book as I haven't used neither Node nor TypeScript for anything even as useful as a CLI game.

Table of Contents

Installation

To play this game, please ensure you have the following requirements installed:

Follow these steps to get started:

  1. Clone the repository:
git clone https://github.com/waikoo/guess-my-number.git
  1. Open the project directory:
cd guess-my-number
  1. Install the dependencies using pnpm:
pnpm i

Usage

How to play

Option 1

To start the game, run the following command:

pnpm start

This will compile the code every time you run it leading to a couple of seconds lag.

Option 2

Instead of waiting it to compile every time you run the command you can also run the TypeScript compiler:

tsc

Then run:

node dist/Game.js

In the future whenever you want to play, you just run the above command.

Features

  • Choose from a set of 5 ranges to guess my number from: 0 - 100, 0 - 1.000, 0 - 10.000, 0 - 100.000, 0 - 1.000.000
  • ASCII art greets you when you start the game and when you win
  • The game understands both syntaxes: 1.000 or 1000 for one thousand
  • Colors everywhere to provide better visual separation
  • Error handling for range selection and number guessing

If you find a loophole in the error handling, see Contributing.

  • The chance for infinite play by pressing the bold green y at the very end of each game.

Technologies Used

  • Node.js
  • TypeScript

Contributing

If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.

Special Thanks

A heartfelt thank you to my wife for her invaluable contributions and support throughout this project. Her attention to detail and keen eye for design have helped polish it to perfection.

Check out her work on Dribble.

License

This project is licensed under the terms of the MIT License. The full text of the license can be found in the LICENSE.txt file.

Releases

No releases published

Packages

No packages published