Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Lbl Right
- .r₁=row scan offset
- .r₂=column scan index
- .r₃=column dest index
- .r₄=last value slid
- 3
- .For each row
- For(4)
- →r₁
- 0→r₄
- 12→r₃
- .For each column, starting from the right
- For(4)
- →r₂
- .If occupied by a tile
- If {+r₁+L₁}
- .Remove original tile
- Select(→r₅,0→{r₁+r₂+L₁})
- .If equal to the last slid tile
- !If -r₄
- .Increment merged tile value
- {r₁+r₃+4+L₁}++
- .If not equal to the last slid tile
- Else
- .Store tile to destination and decrement destination index
- Select(r₅,→{r₃-4→r₃+r₁+4+L₁})
- End
- .Store value last slid (or garbage if a merge occured)
- →r₄
- End
- r₂-4
- End
- r₁-1
- End
- Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement