Added isNextToPiece(int, int) function