Home

1 minute read

Best 5 NPM Command Line Games 🎮

Tony Lea

Best 5 NPM Command Line Games 🎮

Have you ever been inside of terminal and said to yourself, "I wish I could play a quick game of Pong." Yeah, me either, but if that ever comes up, here are 5 cool games that you can install with NPM and play directly in your terminal.

1. Pong 🏓

The beloved pong game where you smack a ball back and forth can easily be installed in your terminal with the following command:

npm i -g command-line-pong

After installing it globally, you can run the following command:

pong

And you'll be able to play a game of pong. Take a look at the quick example below.

You can find this npm package here: https://www.npmjs.com/package/command-line-pong

2. Snake 🐍

Next up is the addictive and sometimes boring snake game. You can play a quick game of snake by running the following NPM command:

npm i -g command-line-snake

Then, you can run the following command:

snake

Take a look at how the game looks below.

Checkout our latest product - the ultimate tailwindcss page creator 🚀

You'll find this NPM package located at https://www.npmjs.com/package/command-line-snake

3. Minesweeper 💣

This next game is the bomb! Well, maybe not, but if you play it, you will probably uncover a bomb. You can easily play a mind-puzzling game of minesweeper by cloning the GitHub repo:

git clone https://github.com/ChalkPE/node-minesweeper.git

Then, you'll need to go into that directory and run the npm dependencies:

cd node-minesweeper && npm install && npm start

And you'll be playing minesweeper just like that.

You can find this NPM game at https://www.npmjs.com/package/node-minesweeper

4. Battleship 🚢

Next, if you're ready to blow up some ships in an epic game of battleship, you can do so by installing this NPM game with the following command:

npm i battleship-game -g

Then, run:

battleship-game

And you'll be blowing ships up in your terminal (or missing them).

You can find this NPM package at https://www.npmjs.com/package/battleship-game

5. Blackjack ♠️

Last but not least! You can play a quick game of blackjack in between a git push by running the following command in a new folder:

npm i node-blackjack

Next, you can run the following command to play a quick game:

touch index.js && echo "require('node-blackjack')" >> index.js && node index.js

You can find this NPM package located at https://www.npmjs.com/package/node-blackjack

Conclusion

That's the round-up of 5 simple NPM CLI based games you can add to spice up your terminal.

I hope you found these games useful (or distracting) 🤓