import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Random;

public
class
InputGenerator {
    public static void
    main(String[] args)
            throws IOException {
        File directory = new File(args.length > 0 ? args[0] : "bmps");
        if (!directory.isDirectory() && !directory.mkdirs()) throw new IOException("Cannot create BMP directory");
        int N = 42;
        Random rand = new Random();
        long s = 42;
        rand.setSeed(s);

        BufferedImage image;

        /*image.setRGB(1,3 , Color.white.getRGB());
        image.setRGB(3,3 , Color.white.getRGB());
        image.setRGB(6,4 , Color.white.getRGB());
        image.setRGB(4,2 , Color.white.getRGB());*/

        int T = 1337;
        while (T-- > 0) {
            image = new BufferedImage(N, N, BufferedImage.TYPE_BYTE_BINARY);
            int n_pixels = N * N / 2, points_in_circle = 0;
            while (points_in_circle < n_pixels) {
                int x = rand.nextInt(N + 1) - N / 2;
                int y = rand.nextInt(N + 1) - N / 2;
                double dist = Math.hypot(x, y);
                if (dist >= 6 && dist <= 20) {
                    image.setRGB(x + 20, y + 20, Color.white.getRGB());
                    ++points_in_circle;
                }
            }
            ImageIO.write(image, "BMP", new File(directory, T + ".bmp"));
        }
    }
}
