online demo is here: https://itsmeab.github.io/React-2048-game/
code is here: https://github.com/itsmeAB/React-2048-game
For further actions, you may consider blocking this person and/or reporting abuse
online demo is here: https://itsmeab.github.io/React-2048-game/
code is here: https://github.com/itsmeAB/React-2048-game
For further actions, you may consider blocking this person and/or reporting abuse
Ankush Goyal -
Ezechiel Kiregha -
Soumyadip -
Dhruvil Joshi -
Top comments (3)
Hey, nice work! I really like the integration.
Congratz ;)
If you want some advice:
In your UI you should integrate the 4 keyboard arrow, to let the user know he has to use the keyboard navigation keys to play (in case he doesn't know :) ) and let him play with mouse if he wants to.
In your code, your methods 'swipeLeft' / 'swipeX'.. have some common parts, you should factorize per example the win check & history update
Exemple block (first line) that can be factorized :
if (JSON.stringify(oldGrid) !== JSON.stringify(newArray)) {
You may also try to comment/name more efficiently your code (commenting Redo on top of onClickRedo is not very useful, constant a, b and c are not meaningful and need documentation to understand better) I found this link interesting about this concept here, but there are plenty others on the net . The global idea is: let the code speak by itself. If your naming is good, it will not need to be commented because it's readability is going to be excellent.
Thank you very much for your advice. I will keep this in mind and try to modify it.
Starred. This deserves more hearts!