<commit_before>package fractals;

/**
 * ImageManager controls the generation of Fractal images.
 * This class uses Threads to ensure that images are rendered as fast
 * as possible.
 */
public class ImageManager {
    // Threaded generator for creating the image
    static class ImageGeneratorThread extends Thread {
        private Fractal f;
        //Defines the maximum number of times an aesthetically unpleasing Fractal can be mutated to attempt to create
        // a more pleasing image
        private static final int MAX_RETRIES = 8;

        public ImageGeneratorThread(Fractal f) {
            this.f = f;
        }

        public void run() {
            f.generateImage();
            int retries = 0;

            //Try to mutate a sparse Fractal to get a less sparse one. If that fails, then recreate the Fractal again.
            do {
                //If the fractal is aesthetically unpleasing, mutate it
                while (f.isSparseImage() && retries++ < MAX_RETRIES) {
                    f.discard();
                    f.inPlaceMutate();<commit_msg>Fix for Fractals not retrying the correct number of times after a redo<commit_after>package fractals;

/**
 * ImageManager controls the generation of Fractal images.
 * This class uses Threads to ensure that images are rendered as fast
 * as possible.
 */
public class ImageManager {
    // Threaded generator for creating the image
    static class ImageGeneratorThread extends Thread {
        private Fractal f;
        //Defines the maximum number of times an aesthetically unpleasing Fractal can be mutated to attempt to create
        // a more pleasing image
        private static final int MAX_RETRIES = 8;

        public ImageGeneratorThread(Fractal f) {
            this.f = f;
        }

        public void run() {
            f.generateImage();
            int retries;

            //Try to mutate a sparse Fractal to get a less sparse one. If that fails, then recreate the Fractal again.
            do {
                retries = 0;
                //If the fractal is aesthetically unpleasing, mutate it
                while (f.isSparseImage() && retries++ < MAX_RETRIES) {
                    f.discard();
                    f.inPlaceMutate();
{'fraction_non_alphanumeric': 0.061832740213523134, 'fraction_numerical': 0.0017793594306049821, 'mean_word_length': 2.0228494623655915, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4415966', 'n_tokens_mistral': 587, 'n_tokens_neox': 561, 'n_words': 240}