public boolean isAdjacent(Cell c){
  if (equals(c))   return false;
  if (col == c.col) {
    return (Math.abs(row - c.row) == 1);
  }
  if (row == c.row) {
    return (Math.abs(col - c.col) == 1);
  }
  return false;
}

public boolean isAdjacent ( Cell c ) { if ( equals ( c ) ) return false ; if ( col == c . col ) { return ( Math . abs ( row - c . row ) == 1 ) ; } if ( row == c . row ) { return ( Math . abs ( col - c . col ) == 1 ) ; } return false ; }
determines if this is adjacent to the given cell either horizontally or vertically . doesn ' t check for invalid c because we don ' t know the full size of the board within cell .
