A command line Snake Game written in JavaScript (Node.js).
Use the arrow keys (โ
, โ
, โ
, โ
) or W
A
S
D
to navigate the snake up, down, left, or right. Eat the red dot to gain points. If the snake collides with the wall or its own tail, it's game over. Press ENTER
to restart, and Q
, ESCAPE
or CTRL
+ C
to quit the game.
The easiest way to play the game is to just run it in the terminal without installing anything!
npx node-snake-cli
git clone https://github.com/T4533N/node-snake-cli
cd node-snake-cli
# install and run via npm or yarn
npm i && npm run play
Add the node-snake-cli
module.
npm i node-snake-cli
Create the game.
// index.js
const { UserInterface, Game } = require('node-snake-cli')
const game = new Game(new UserInterface())
// Begin game
game.start()
Run the game.
node index.js
This project is open source and available under the MIT License.