Skip to content

stalker8610/snake

Repository files navigation

Oldschool game 'Snake'

Description

Simple oldschool game 'Snake' for console, may be played just in Node.js terminal or on Windows Command Prompt (cmd.exe)

Project setup and run

  • Download project files, then in project folder run command:
npm install
  • Make sure terminal window size enough to play, then run command:
npm run start

Note: it's not recommended to resize terminal window during the play due possibility of unexpectable cursor moving and graphical output crashing

How to play

  • Use keyboard arrows to move snake
  • Pick up yellow 'cookies' to get score
  • Avoid of red obstacles and boundaries
  • You may toogle pause with 'p' key
  • Press 'Ctrl+C' to exit

Project structure

Program consists of three main classes:

  • Game - describes game environment such as game loop, user's control maintance and graphical output. See game.js
  • Snake - describes structure of snake's body with it's fractures and directions of movement for each fracture (without any graphical output). This class used by Game class. See snake.js
  • Interface - describes input and output interface used by Game class, see interface.js

Dependencies and other requirements

This project uses the only one external module 'chalk' for styling text in console (see https://github.com/chalk/chalk)

This project requires of Node.js 12+ due private classes fields used

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published