private void addJumpMoves(CkMove m, int sx, int sy, boolean kingFlag) {

		// Determine the range of directions to examine.  If not a king,
		// they can only move forward.

		int startD = 0;
		int endD = 4;

		if (!kingFlag) {
			startD = (plrTurn == 0 ? 0 : 2);
			endD = startD + 2;
		}

		// Save the current move total, to detect if we found any further jump moves.

		int oldMoveTotal = legalMoveCount;

		// Don't add any more jumps if we've exceeded the limit.

		if (m.totalJumps() < CkMove.maxJumps())
		 for (int d = startD; d < endD; d++) {

		 	// Determine where a jump in this direction would take us.

			int nx = sx + xMovesJ[d];
			int ny = sy + yMovesJ[d];

			// We can't jump off the board...

			if (!withinBoard(nx,ny)) continue;

			// ... or onto another piece.

			if (readCell(nx,ny) != 0) continue;

			// Interpolate to find the coordinates of the piece we are capturing

			int cx = (sx+nx)>>1;
			int cy = (sy+ny)>>1;

			// There has to be an enemy piece there to capture.

			int captured = readCell(cx,cy);
			if (pieceColor(captured) != 2 - plrTurn) continue;

			// We found a jump in this direction, so simulate the jump
			// and call the function again.

		/*	According to the rules of checkers, you can't become a king and
			keep jumping.

			// Determine the new king flag.  If jumping will take us to the
			// promotion rank, set it true.

			boolean newKingFlag = kingFlag || promotionRow(ny);
		*/

			// Remove the captured piece from the board.

			setCell(cx,cy,0);

			// Add this jump to the move.

			m.extend(d, captured);

			// Call the function recursively, with the destination of this jump
			// as the starting point for the next jump.

			addJumpMoves(m, nx, ny, kingFlag /*newKingFlag*/);

			// Undo the effect of the simulated jump.

			// Subtract the last jump from the move

			m.shrink();

			// Put the captured piece back on the board.

			setCell(cx,cy,captured);
		}

		// We only add the move to the list if we have reached the end of any possible
		// jumps.

		if (
			oldMoveTotal == legalMoveCount
		 && m.totalJumps() > 0
		) {
			m.setIndex(legalMoveCount);
			legalMoves[legalMoveCount++] = new CkMove(m);
		}
	}