/2048

2048 is a single-player sliding tile puzzle game

Primary LanguageJavaScriptMIT LicenseMIT

2048

2048 is a single-player sliding tile puzzle game

Rules of 2048:

2048 is played on a 4×4 grid, with numbered tiles that slide smoothly when a player moves them using the four arrow keys. Each time you slide, a new tile will randomly appear in an empty spot on the board. Tiles slide as far as possible in the chosen direction until they are stopped by either another tile or the edge of the grid. If two tiles of the same number collide while moving, they will merge into a tile with the total value of the two tiles that collided. The resulting tile cannot merge with another tile again in the same move.

By creating this popular game we will learn the following javaScript Methods:

  • querySelector()
  • getElementById()
  • createElement()
  • appendChild()
  • push()
  • Math.floor()
  • Math.random()
  • length
  • innerHTML
  • parseInt()
  • filter()
  • Array()
  • fill()
  • concat()
  • keyCode
  • addEventListener()
  • removeEventListener()
  • setTimeout()
  • clearInterval()
  • setInterval()

Here's the Site to play