function findAdjacencyDirection(tileLoc, nullLoc) {
  /* Return an x or y direction relative to the null space if the tile is adjacent, or if it isn't then return null
             [0, -1]
     [-1, 0]  null  [1, 0]
             [0, 1]
  */
  if (tileLoc - nullLoc === 5) {
    return [0, 1];
  } else if (tileLoc - nullLoc === -5) {
    return [0, -1];
  } else if (tileLoc - nullLoc === 1 && tileLoc % 5 !== 0) {
    return [1, 0];
  } else if (tileLoc - nullLoc === -1 && tileLoc % 5 !== 4) {
    return [-1, 0];
  } else return null;
}
// Given a tile location and the location of the empty spot, tell us whether a move's valid, and if so, in what direction
Given a tile location and the location of the empty spot, tell us whether a move's valid, and if so, in what direction
Given a tile location and the location of the empty spot tell us whether a move ' s valid and if so in what direction
function findAdjacencyDirection(tileLoc, nullLoc) {
  if (tileLoc - nullLoc === 5) {
    return [0, 1];
  } else if (tileLoc - nullLoc === -5) {
    return [0, -1];
  } else if (tileLoc - nullLoc === 1 && tileLoc % 5 !== 0) {
    return [1, 0];
  } else if (tileLoc - nullLoc === -1 && tileLoc % 5 !== 4) {
    return [-1, 0];
  } else return null;
}
function findAdjacencyDirection ( tileLoc , nullLoc ) { if ( tileLoc - nullLoc === 5 ) { return [ 0 , 1 ] ; } else if ( tileLoc - nullLoc === - 5 ) { return [ 0 , - 1 ] ; } else if ( tileLoc - nullLoc === 1 && tileLoc % 5 !== 0 ) { return [ 1 , 0 ] ; } else if ( tileLoc - nullLoc === - 1 && tileLoc % 5 !== 4 ) { return [ - 1 , 0 ] ; } else return null ; }
Given a tile location and the location of the empty spot, tell us whether a move's valid, and if so, in what direction
Given a tile location and the location of the empty spot tell us whether a move ' s valid and if so in what direction
/* Return an x or y direction relative to the null space if the tile is adjacent, or if it isn't then return null
             [0, -1]
     [-1, 0]  null  [1, 0]
             [0, 1]
  */