@marcster/snake-js
v1.0.1
Published
Play snake with Node.js in the terminal
Downloads
2
Readme
Snake-js
Play the famous snake game in your terminal.
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 beforesetTimeout
- speed - game speed in ms