Coder Social home page Coder Social logo

snake's Introduction

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

snake's People

Contributors

stalker8610 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.