Skip to content
/ 2048 Public

Implementation of 2048 game. This app made in React way, game logic and ui logic is separated.

Notifications You must be signed in to change notification settings

harunfr/2048

Repository files navigation

2048 Clone

Live Demo 👈

Was popular game at year 2014. Revamped with minimal animation.

Snapshot of Game

Game Logic

  • Game logic just calculates final appereance of cells.
  • Doesn't use moving blocks, if would use animations would be possible.
  • Is seperated from UI logic.

Mechanism of Changing Cells State

  • Numbers first joins together if they are same,
  • Then moves to empty space in front of them.
  • Finally, game puts number 2 or number 4 on empty blocks.

UI Logic - Code

  • Used too much wrapper with same name, I should have preffered code repetition over drying out and make it hard to read.
  • uuid library is not always the best solution, array indexes can be used as key.
  • Used tests to develop game logic, so implementing UI logic and knowing where to look when encountered an exception was easy.

Clone, Browse, Build, Run.

		git clone [email protected]:harunfr/2048.git && cd 2048/ && code . && npm i && npm start

About

Implementation of 2048 game. This app made in React way, game logic and ui logic is separated.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published