@marcster/snake-js

1.0.1 • Public • Published

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

/@marcster/snake-js/

    Package Sidebar

    Install

    npm i @marcster/snake-js

    Weekly Downloads

    0

    Version

    1.0.1

    License

    ISC

    Unpacked Size

    9.31 kB

    Total Files

    8

    Last publish

    Collaborators

    • marcster