public boolean isAdjacentAndEmpty(int fromR,int fromC,int toR,int toC){
  if (board[toR][toC] != EmptyMark) {
    return false;
  }
  int dR=Math.abs(fromR - toR);
  int dC=Math.abs(fromC - toC);
  if ((dC == +1 && dR == 0) || (dC == 0 && dR == +1)) {
    return true;
  }
  return false;
}

public boolean isAdjacentAndEmpty ( int fromR , int fromC , int toR , int toC ) { if ( board [ toR ] [ toC ] != EmptyMark ) { return false ; } int dR = Math . abs ( fromR - toR ) ; int dC = Math . abs ( fromC - toC ) ; if ( ( dC == + 1 && dR == 0 ) || ( dC == 0 && dR == + 1 ) ) { return true ; } return false ; }
ensure that the empty square is in [ tor ] [ toc ] and that [ fromr ] [ fromc ] is adjacent horizontally or vertical .
