2048 Game
Welcome to the seventeenth edition of Elixir Quiz. This week we will be creating our own version of the game, 2048.
The 2048 Game
2048 is a game that was created in 2014 by developer Gabriele Cirulli, and is reminiscent of Sliding Puzzle games.
The game is played on a 4x4 grid, which is initially empty except for 2 randomly selected tiles, which have either a 2 or a 4 value in it. Players play the game by pushing all of the tiles in a specified direction; up, down, left or right.
When tiles with matching values come into contact, they merge into one (the one furthest in the direction that was specified). The value of this new tile is the combined value of the tiles. After each turn, a new tile (either a 2 or a 4) is generated in one of the free spaces.
The player wins by creating a tile with the value 2048, and loses if the board is filled with tiles and no more moves are available.
The problem
Create the game of 2048. You can simply use the command line for output, or build a web application if you’re feeling ambitious.
How do I enter?
The 2048 quiz runs from Saturday December 13th 2014 until Friday December 19th, 2014.
To enter, just complete the problem and post a link to the code on Twitter, and mention @elixir_quiz. As always, you can host your code anywhere (like Github Gists).
Example solutions
After the quiz period ends on December 19th, I will update this section and talk about some interesting solutions that were posted on Twitter.