In 2048, matching values merge in pairs starting from the side you move toward. A tile created during a move cannot merge a second time in that same move. This boundary makes the resulting board predictable.
Four matching tiles become two pairs
When moving left, these rows change as follows:
[2, 2, 2, 2]becomes[4, 4, 0, 0][2, 2, 4, 4]becomes[4, 8, 0, 0][4, 4, 4, 0]becomes[8, 4, 0, 0]
The two new 4 tiles in the first example do not immediately become 8. They need another move before they can merge. Moving right applies the same rule from the right edge. Moving up or down applies it to each column from the chosen edge.
Each merged value increases the score
Merging 2 and 2 creates 4 and adds 4 points. Merging 4 and 4 creates 8 and adds 8 points. A single move that changes [2, 2, 4, 4] into [4, 8, 0, 0] therefore adds 12 points.
A move that only shifts tiles does not add merge points, but it does change the board, so one new tile appears. A direction that moves nothing adds neither a tile nor score.
Read one line from the moving edge
The vertical rules are identical to the horizontal rules. Remove the gaps, scan from the edge you are moving toward, merge each matching pair once, and fill the remaining cells with zeroes.
Return to the 2048 playing guide for the controls and game-over condition.