js/arrangeTiles.Grid.js
// Check to see if the tile at the specified coordinates can slide
Check to see if the tile at the specified coordinates can slide
Check to see if the tile at the specified coordinates can slide
function canMoveTile (row, col) {
            var up = (row - 1 >= 0) ? row - 1 : false,
                down = (row + 1 <= maxGridIdx) ? row + 1 : false,
                left = (col - 1 >= 0) ? col - 1: false,
                right = (col + 1 <= maxGridIdx) ? col + 1 : false,
                canMove = false;
            canMove = (canMove) ? canMove : (up !== false && tiles[up][col] === 0);
            canMove = (canMove) ? canMove : (down !== false && tiles[down][col] === 0);
            canMove = (canMove) ? canMove : (left !== false && tiles[row][left] === 0);
            canMove = (canMove) ? canMove : (right !== false && tiles[row][right] === 0);
            return canMove;
        }
function canMoveTile ( row , col ) { var up = ( row - 1 >= 0 ) ? row - 1 : false , down = ( row + 1 <= maxGridIdx ) ? row + 1 : false , left = ( col - 1 >= 0 ) ? col - 1 : false , right = ( col + 1 <= maxGridIdx ) ? col + 1 : false , canMove = false ; canMove = ( canMove ) ? canMove : ( up !== false && tiles [ up ] [ col ] === 0 ) ; canMove = ( canMove ) ? canMove : ( down !== false && tiles [ down ] [ col ] === 0 ) ; canMove = ( canMove ) ? canMove : ( left !== false && tiles [ row ] [ left ] === 0 ) ; canMove = ( canMove ) ? canMove : ( right !== false && tiles [ row ] [ right ] === 0 ) ; return canMove ; }
Check to see if the tile at the specified coordinates can slide
Check to see if the tile at the specified coordinates can slide