Skip to content
Projets

À propos

🐍 ‎ A terminal-based Snake implementation written in JavaScript.

Jeux et émulation

Comment ces chiffres sont mesurés

Progression mesurée des étoiles

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
Historique en cours

Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.

README.md

Original

🐍 Snek.js

License: MIT snekjs on NPM

Run on Repl.it

A terminal-based Snake implementation written in JavaScript (Node.js).

Read the tutorial

snek.gif

Instructions

Use the arrow keys (↑, ↓, ←, →) or W A S D to navigate the snake up, down, left, or right. Eat the red dot to gain points. If the snake collides with the wall or its own tail, it's game over. Press ENTER to restart, and Q, ESCAPE or CTRL + C to quit the game.

Installation

Run without installing

The easiest way to play the game is to just run it in the terminal without installing anything!

npx taniarascia/snek

Clone from repository

git clone https://github.com/taniarascia/snek
cd snek

# install and run via npm or yarn
npm i && npm run play

npm module

Add the snekjs module.

npm i snekjs

Create the game.

// index.js
const { UserInterface, Game } = require('snekjs')
const game = new Game(new UserInterface())

// Begin game
game.start()

Run the game.

node index.js

Acknowledgements

  • Vanya Sergeev for pointing out my snake collision bug, for advising me to make a single, reusable draw method, for showing me how to properly bind methods between classes, and for overall guidance and inspiration.
  • Devin McIntyre for general advice.
  • Panayiotis Nicolaou's JavaScript Snake for Web for initial logic.

Author

License

This project is open source and available under the MIT License.

Explorer des projets similaires

Chargement…