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.
To play this game, please ensure you have the following requirements installed:
Follow these steps to get started:
- Clone the repository:
git clone https://github.com/waikoo/guess-my-number.git
- Open the project directory:
cd guess-my-number
- Install the dependencies using pnpm:
pnpm i
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.
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.
- 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
or1000
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.
- Node.js
- TypeScript
If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.
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.
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.