Computation Contest #8 Results and Solution


The problem of this contest was to simply draw a fractal of your choice.
I chose to draw this fractal as an example:

This fractal was generated with the chaos game algorithm.
The chaos game works on a few simple rules:

Start with a set of n points in a 2d plane.
Choose a random point x on the plane.
Now in a loop make:
  1. Choose one of the n points randomly
  2. Move x half the distance towards the chosen point
  3. Paint a dot at x(Preferably with low alpha, to make the image look smoother).

In the example shown above I used 5 points:
The 4 corners of a rectangle and the exact center.

Here is my implementation:

import javax.swing.JFrame;
import java.awt.Color;
import java.awt.Graphics;

public class fractal extends JFrame {
    double x, y;
    int len;
    double [] xP;
    double [] yP;
    public fractal() {
        // Initialize JFrame:
        this.setSize(1800, 1200);
        // Initialize points:
        // Here 4 corners of a rectangle and the center:
        xP = new double[]{100, 100, 1700, 1700, 900};
        yP = new double[]{100, 1100, 1100, 100, 600};
        len = 5;
        // Start at one of the corners:
        x = xP[0];
        y = yP[0];
    int n = 0;
    public void paint(Graphics g) {
        // Make sure the background really gets drawn black:
        if(n <= 100) {
            g.fillRect(0, 0, 1800, 1200);
        // Use some color different to the background with low alpha value to draw the current position of the dot:
        g.setColor(new Color(255, 255, 255, 2));
        g.drawRect((int)x, (int)y, 1, 1);
        // Choose a new point:
        int z = (int)(len * Math.random());
        // Move the point half the distance to that point:
        x -= (x-xP[z])/2;
        y -= (y-yP[z])/2;
    public static void main(String [] args) {
        fractal f = new fractal();
        while(true) {

I wonder why only one participant showed up, although it wasn't that hard.


List of participants with their entries:

NameSolution foundComment
@enderragLooks good, although I don't like that the edges are cut.



Congratulations @enderrag, you won 2 SBI!


The next contest starts soon. Don't miss it!


Congratulations @mapxv, 50.57% upvote has been shared with your successful call on the post that shared by @quantumdeveloper!

Support @trendotoken projects by delegating : 100SP , 200SP , 500SP , 1000SP , 2000SP

Congratulations @quantumdeveloper, your post successfully recieved 4.724892 TRDO from below listed TRENDO callers:

@mapxv earned : 3.149928 TRDO curation

To view or trade TRDO go to
Join TRDO Discord Channel or Join TRDO Web Site

Coin Marketplace

STEEM 0.25
TRX 0.11
JST 0.033
BTC 62986.12
ETH 3072.14
USDT 1.00
SBD 3.84