Skip to content

Node.js based Snake game that play in your terminal

Notifications You must be signed in to change notification settings

m4rcster/snake-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snake-js

Play the famous snake game in your terminal.

alt text

Installation

npm install --save @marcster/snake-js

Usage

let Snake = require('@marcster/snake-js');

// Snake(board width, board height, callback on loop end, speed in ms)

let snake = new Snake(10, 10, () => {

    let score = snake.score;

    // parse score to string
    snake.debug('' + score);
    
  }, 200);

Options

  • Width - width of game area (will be multiplied by 2 since snake emoji requires 2 characters in terminal)
  • Height - height of game area
  • callback - function called during each loop after draw() but before setTimeout
  • speed - game speed in ms

About

Node.js based Snake game that play in your terminal

Resources

Stars

Watchers

Forks

Packages

No packages published