Giter Club home page Giter Club logo

project1's Introduction

project1

This is a game based off of the popular 2048 game by Gabriele Cirulli. This was created using HTML, CSS, jQuery and Javascript in the Sublime text editor.

The game works by first randomly generating two tiles. Each randomly generated tile has a value of either 2 or 4. The player slides tiles across the board using the arrow keys. Tiles will move only if they can be combined with another tile of the same value, or if there is a blank tile next to it.

In order to combine like tiles, the gameboard values were converted into an array, then run through a for loop, and then re-inserted into the gameboard.

In order to check to see if a valid move was made, a string was created from the current state of the board, and another string was created after an arrow key was pressed. Then once the key is released, a function would be called that compared the two strings. If they are exactly the same, then no move was made. If a move was made, a new tile would be inserted into an empty tile on the gameboard.

Win condition: A player wins once they create a tile with the value of 2048.

project1's People

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.