Advertisement
Runer112

Up slide

Apr 18th, 2014
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Lbl Right
  2. .r₁=row scan offset
  3. .r₂=column scan index
  4. .r₃=column dest index
  5. .r₄=last value slid
  6. 3
  7. .For each row
  8. For(4)
  9. →r₁
  10. 0→r₄
  11. 12→r₃
  12. .For each column, starting from the right
  13. For(4)
  14. →r₂
  15. .If occupied by a tile
  16. If {+r₁+L₁}
  17. .Remove original tile
  18. Select(→r₅,0→{r₁+r₂+L₁})
  19. .If equal to the last slid tile
  20. !If -r₄
  21. .Increment merged tile value
  22. {r₁+r₃+4+L₁}++
  23. .If not equal to the last slid tile
  24. Else
  25. .Store tile to destination and decrement destination index
  26. Select(r₅,→{r₃-4→r₃+r₁+4+L₁})
  27. End
  28. .Store value last slid (or garbage if a merge occured)
  29. →r₄
  30. End
  31. r₂-4
  32. End
  33. r₁-1
  34. End
  35. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement