Skip to content

Latest commit

 

History

History
37 lines (29 loc) · 619 Bytes

README.md

File metadata and controls

37 lines (29 loc) · 619 Bytes

snake-cli-ts

CLI Snake Game written in NodeJS and TypeScript

Usage

npx snake-cli-ts

or full install:

# Install
npm i snake-cli-ts -g
# Just type in console:
snake

Example ss

Use as module

// CommonJS modules
const SnakeGame = require('snake-cli-ts').default;
// ES6 modules with Babel or TypeScript
import SnakeGame from 'snake-cli-ts';
const game = new SnakeGame({
  moveThroughWall: false,
  difficulty: 'easy',
}).on('gameOver', () => {
  console.clear();
  console.log(`Your score: ${game.snake.body.length} points`);
  process.exit();
}).init();