• Stars
    star
    273
  • Rank 150,780 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 5 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿ โ€Ž A terminal-based Snake implementation written in JavaScript.

๐Ÿ 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.

More Repositories

1

takenote

๐Ÿ“ โ€Ž A web-based notes app for developers.
TypeScript
6,839
star
2

webpack-boilerplate

๐Ÿ“ฆ โ€Ž A sensible webpack 5 boilerplate.
JavaScript
2,390
star
3

taniarascia.com

๐Ÿ’พ โ€Ž Personal website running on Gatsby, React, and Node.js.
JavaScript
2,003
star
4

wp-functions

A compilation of function snippets for WordPress developers who create their own themes.
1,216
star
5

new-moon

๐ŸŒ™ โ€Ž The optimized dark theme for web development.
Less
1,216
star
6

primitive

โ›๏ธ โ€Ž A front-end design toolkit for developing web apps.
SCSS
919
star
7

react-tutorial

A walkthrough of basic React concepts.
CSS
739
star
8

mvc

A simple MVC application in plain JavaScript.
JavaScript
580
star
9

sandbox

Development sandbox for front end projects and tutorials.
JavaScript
534
star
10

chip8

๐ŸŽฎ โ€Ž A Chip-8 emulator written in JavaScript for web, CLI, and native UI.
JavaScript
424
star
11

react-hooks

Build a CRUD app in React with Hooks.
JavaScript
376
star
12

laconia

๐Ÿบ โ€Ž A minimalist MVC framework.
PHP
362
star
13

pdo

Connecting to MySQL in PHP using PDO.
PHP
230
star
14

startwordpress

Learn how to develop a WordPress theme from scratch with this basic skeleton and accompanying tutorial.
PHP
210
star
15

chat

๐Ÿ’ฌ ๐Ÿ• โ€Ž very chat. such messages. so talking. wow. React/Redux, TypeScript, Socket.io chat app.
TypeScript
203
star
16

accordion

๐Ÿช— Play the accordion with your computer keyboard!
JavaScript
181
star
17

vue-tutorial

A walkthrough of basic Vue concepts.
Vue
149
star
18

react-advanced-form

An example of a schema-based form system for React.
JavaScript
130
star
19

oblate

Custom theme for my personal website and blog.
PHP
123
star
20

startjekyll

An example and guide to getting started with Jekyll and static site generators.
CSS
116
star
21

memory

โญ โ€Ž JavaScript Memory Game.
JavaScript
113
star
22

node-api-postgres

RESTful API with Node.js, Express, and Postgres.
JavaScript
104
star
23

upload

How to Upload a File to a Server in PHP
PHP
103
star
24

bootstrapblog

Build on the official Bootstrap blog starter template to learn how to make a WordPress theme.
HTML
96
star
25

sokoban

Sokoban.js ๐Ÿ“ฆ
JavaScript
91
star
26

new-moon-vscode

New Moon Theme for Visual Studio Code.
90
star
27

untheme

A blank WordPress theme for developers.
PHP
88
star
28

new-moon-chrome-devtools

New Moon Theme for Chrome Devtools.
CSS
58
star
29

card

A well-designed card element.
CSS
57
star
30

new-moon-sublime

New Moon Syntax Theme for Sublime Text
54
star
31

router-example

Use React Router DOM to create a Single Page Application (SPA).
JavaScript
52
star
32

tictactoe

#๏ธโƒฃ Tic Tac Toe in TypeScript.
TypeScript
42
star
33

baba

JavaScript
31
star
34

node-test

How to make your first Node.js project
JavaScript
26
star
35

new-moon-atom-syntax

New Moon Syntax Theme for Atom
CSS
25
star
36

new-moon-brackets

New Moon Theme for Brackets.
Less
22
star
37

calc

Unit Testing in JavaScript
JavaScript
20
star
38

graphql-fantasy-api

JavaScript
19
star
39

dotfiles

Dotfile configuration.
15
star
40

taniarascia

13
star
41

singularity

An online, text-based dystopian strategy game built in PHP. Modified from the original QMT Promisance code.
PHP
12
star
42

3d

3D printer projects.
10
star
43

coffee

Cafรฉtography
JavaScript
10
star
44

new-moon.vim

port of taniarascias newmoon colorscheme
Vim Script
10
star
45

startgrunt

Learn how to install Grunt and use it to create a Sass and JavaScript workflow.
JavaScript
10
star
46

comments

Comments
7
star
47

httpcast

HTML
5
star
48

signals

Signal test
JavaScript
3
star