A merged tile cannot merge again
In a row of four 2s, one move produces two 4s — not a single 8. A tile created by a merge is spent for the rest of that move, and implementations that miss this rule are dramatically easier than the real game.
It is the single most commonly broken rule in browser clones, and it is worth checking before you trust a score from anywhere. Line up four identical tiles, make one move, and count what comes back. Two tiles is correct. One is a version that has quietly halved the game's difficulty.
The move itself is written once, for a single direction, and the other three are done by rotating the board into that direction and back. Four near-identical loops is where almost every bug in this puzzle comes from.