Draw a Fractal in Under 200 Characters

3

1

After noticing all the fractal submissions/questions, I thought it would be fun to start a contest where everyone submits their favourite fractal.

The Contest

Generate a fractal in under 200 characters using any language. The output of the function can be an image, ascii art or any representation of a fractal you can think of. In your submission include your code, how to run your code, and sample outputs of your fractal. This is a popularity contest, so the submission with the most votes wins.

Rules

  • You may use any libraries, except those which generate fractals (e.g. a library function that generates a mandelbrot set is not allowed)
  • It is difficult to define a true fractal, so I will accept anything that has self-similarity and has fractal dimension greater than its topological dimension
  • You may submit multiple answers

Good luck, have fun!

Cameron

Posted 2014-10-14T02:27:45.100

Reputation: 997

Question was closed 2014-10-14T06:59:08.927

1This is likely to be marked as a duplicate since there are many many answers to previous questions that could simply be copied over. – Calvin's Hobbies – 2014-10-14T02:50:50.073

The rules of this question do allow a lot of previous submissions to be used, however this a popularity contest. Part of the challenge will be creating a visually appealing fractal, in order to get votes. A code-golfed submission means less than an artistic submission. – Cameron – 2014-10-14T03:07:40.433

7This question appears to be off-topic because it is an art contest rather than a programming contest. – Dennis – 2014-10-14T03:18:52.930

I don't see how this challenge is of a very different style as a question like this.

– Cameron – 2014-10-14T03:51:48.107

1Having read the meta post(s?) about art contests, I don't see a big problem with this post. The point is that there's a big restriction on the source, so it's not just an art contest, it has a substantial code golfing element as well. (Though personally I think 512 characters is too much, I've seen and created quite a few nice fractals in 140 characters or less. Someone just posted an entire ray tracing engine in 467.) – Nathaniel – 2014-10-14T04:45:43.477

All question tagged "fractal" have answer of less than 100 characters, many are visually stunning. A limit of 512 chars makes this simply an art contest. – edc65 – 2014-10-14T04:52:04.167

I wanted the challenge to focus more on the output rather than the code length, but I see that 512 characters is a bit too generous. I will reduce the maximum code length to 200. – Cameron – 2014-10-14T05:05:37.820

4While I agree that this is in the same vein as the tweetable maths challenge, I'd still close vote this: as too broad. The main problem I see is that it preempts dozens of interesting fractal challenges. Imagine this question gets reopened and does get popular with tons of answers - it might get solutions for a dozen fractals or more. Any future code golf challenge drawing one of the fractals that has been drawn here, would have to be closed as duplicate, because one ore more competitive answers could already be found here. – Martin Ender – 2014-10-14T08:19:21.833

Answers

4

Python, 127 bytes

Creates a Sierpinski triangle.

import Image
f=1e3
a=Image.new('RGB',(f,f))
p=a.load()
r=range(f)
for i in r:
 for j in r:p[i,j]=(i*16&j*16,)*3
a.save('s.png')

Beta Decay

Posted 2014-10-14T02:27:45.100

Reputation: 21 478

a=I.new('RGB',(t,t)) and a.save('s.png') and p[i,j]=m,m,m – gnibbler – 2014-10-15T00:37:52.340

you can also get rid of r, for j in range(a.size[1]):p[i,j]=(i*16&j*16,)*3 – gnibbler – 2014-10-15T00:45:14.400

@gnibbler Thanks for that! – Beta Decay – 2014-10-15T05:58:20.763

t=1000and (t,t) can be shortened to (1000,)*2 – ThinkChaos – 2014-10-15T16:00:39.747