Advertisement
Guest User

Untitled

a guest
Jul 7th, 2015
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. (function() {
  2. function dropStones(row) {
  3. for (i = row.length-2; i >= 0; i--) {
  4. if (row[i] === 'o') {
  5. var tmpI = i;
  6. while(row[tmpI + 1] === '.') {
  7. row[tmpI] = '.';
  8. row[++tmpI] = 'o';
  9. }
  10. }
  11. }
  12. return row.join("");
  13. }
  14.  
  15. map.forEach(function(row, y) {
  16. map[y] = dropStones(row.split(''));
  17. });
  18.  
  19. return map;
  20. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement