public void giveHint() {
		/*
		 * Get the number of filled cells and check if there are any empty cells
		 * left to give hints in.
		 */
		int clues = Sudoku.getNumberOfClues(recentGrid);
		if (clues == this.SIZE * this.SIZE) {
			return;
		}

		/*
		 * Save the recent state so undo() can be called on this action.
		 */
		undoStorage.push(SudokuBuilder.deepCopy(recentGrid));
		limitStack(undoStorage);
		
		/*
		 * Try to find a random empty cell to write the hint in. If for 30
		 * iterations there was no empty cell stop trying at random.
		 */
		Random prng = new Random();
		int i = 0;
		while (i < 40) {
			int x = prng.nextInt(SIZE);
			int y = prng.nextInt(SIZE);

			/*
			 * If the cell is empty, give the hint and end the loop.
			 */
			if (recentGrid[y][x] == 0) {
				recentGrid[y][x] = solvedGrid[y][x];
				i = -1;
				break;
			}
			i++;
		}

		/*
		 * If the first loop did not manage to find an empty cell, go through
		 * the Sudoku once more and give the hint in the first empty cell found.
		 */
		if (i != -1) {
			outer: for (int y = 0; y < this.SIZE; y++) {
				for (int x = 0; x < this.SIZE; x++) {
					if (recentGrid[y][x] == 0) {
						recentGrid[y][x] = solvedGrid[y][x];
						break outer;
					}
				}
			}
		}
		
		redoStorage.clear();
	}