Skip to content
🐍 A terminal-based Snake implementation written in JavaScript (Node.js)
Branch: master
Clone or download
taniarascia Merge pull request #7 from corlaez/npx-snek
Add npx support to run snek without previous install
Latest commit 3ab9e67 Apr 18, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
src score number will be more visible if scoreBox color will be white Apr 16, 2019
.gitignore Snake v1 Apr 3, 2019
LICENSE Add README Apr 3, 2019
index.js Clean up, just need to add restart function Apr 8, 2019
package.json Specify npx entry point Apr 17, 2019

🐍 Snek.js License: MIT snekjs on NPM

A terminal-based Snake implementation 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.


Clone from repository

git clone
cd snek

# install and run via npm or yarn
npm install && npm run play
yarn && yarn play

npm module

Add the snekjs module.

yarn add snekjs

Create the game.

// index.js
const { UserInterface, Game } = require('snekjs')
const game = new Game(new UserInterface())

// Begin game

Run the game.

node index.js


  • Vanya Sergeev for pointing out my snake collision bug, for advising me to make a single, reusable draw method, for showing me how to properly bind methods between classes, and for overall guidance and inspiration
  • Devin McIntyre for general advice
  • Panayiotis Nicolaou's JavaScript Snake for Web for initial logic



This project is open source and available under the MIT License.

You can’t perform that action at this time.