Skip to content

jxav22/JavaScriptSnake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JavaScript Snake 🐍

I rebuilt snake, but with intentional limitation that everything is in JavaScript.

Here's a link to the main file

image

Features

Vanilla JavaScript

Everything, including the styling and instantiataion of HTML elements, is done in JavaScript.

High performing

I put a lot of consideration into algorithm efficiency, as a result no method has a time complexity greater than O(n).

A principled design

I utilized OOP and SOLID principles to create a modular, reusuable design.

Notably, the rendering logic is kept seperate from the game logic, it is a design that can easily be reimplemented in any language.

Technologies Used

JavaScript NextJS Vercel

How to Play

Use the arrow keys, on your keyboard, to control the snake's direction.

Collect the food items to increase the length of the snake.

Avoid colliding with the walls or the snake's own body, as it's game over after that.

Installation

To run this locally, follow these steps:

git clone <repository-url>
cd javascript-snake-game
npm install
npm run dev

Then open your browser and visit http://localhost:3000 to play

A live deployment

Alternatively, take a look at my portfolio for a live deployment

https://portfolio-jxav22.vercel.app/

About

Snake, in 100% vanilla JavaScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published