A case about merge

hello, i’m not sure about a situation. When I input a row 2,0,2,2, after running the merge.asm what is the output? 2,0,4,0 or 4,0,0,2

Since the project description says:

The subroutine shall merge two adjacent tiles with equal values in a row towards the left.

you should only merge two equal tiles, if they are next to each other, with no empty tiles between.
The idea is, before you call the merge subroutine the tiles are shifted to the left, so they are next to each other, and then merged. To prevent multiple merges of the “same tile” in one call, the result of the merge is put to the left, and a zero in the right, which should prevent from a second merge.
For example:
If you have a board like 2,2,2,2, you should get 4,0,4,0 as result and should be finished.
So your output in the case 2,0,2,2 should be 2,0,4,0, because 2!=0, 0!=2 and 2=2.

Regards Simeon

4 Likes

OK, thanks, that made me clear.