Game 2048 - Full Front End Project with Vanila JS
2048 is a single-player sliding tile puzzle video game written by Italian web developer Gabriele Cirulli and published on GitHub. The objective of the game is to slide numbered tiles on a grid to combine them to create a tile with the number 2048; however, one can continue to play the game after reaching the goal, creating tiles with larger numbers. It was originally written in JavaScript and CSS over a weekend, and released on 9 March 2014 as free and open-source software subject to the MIT License. Versions for iOS and Android followed in May 2014
My biggest contribution is to the algorithm for moving numbers. The algorithms available on the Internet work with 4 different functions moveup, movedown, moveleft, moveright.
The algorithm I made works with just one move and that is moveleft, for moveUp i user transposed moveleft , for right mirror moveleft for down transposed mirror moveleft.
The rest of the JS is made entirely generic.
Additional functionalities are Restarting points, Restarting the game, etc.