Skip to main content

Questions tagged [fractal]

Fractals are shapes that are self-similar and are usually quite detailed. Well-known fractal sets include the Mandelbrot set, Julia sets, and Phoenix sets. Tree-like fractal drawings are also common.

Filter by
Sorted by
Tagged with
47 votes
44 answers
19k views

Draw A Sierpinski Triangle

The Sierpinsky Triangle is a fractal created by taking a triangle, decreasing the height and width by 1/2, creating 3 copies of the resulting triangle, and place them such each triangle touches the ...
Kibbee's user avatar
  • 959
81 votes
30 answers
13k views

Create an "H" from smaller "H"s

Challenge Create a function or program that, when given an integer size, does the following: If size is equal to 1, output ...
Bazinga_9000's user avatar
26 votes
30 answers
5k views

Sierpinski Carpets

Who doesn't love a good fractal? The Sierpinski Carpet is a classic example of a fractal. To complete this task, you will be required to generate a carpet of type \$n\$ and print the resulting image ...
Paul Clavier's user avatar
26 votes
5 answers
2k views

ASCII Dragon's Curve

Introduction The Dragon's Curve is a fractal curve that notably appears on section title pages of the Jurassic Park novel. It can very simply be described as a process of folding a paper strip, as ...
Fatalize's user avatar
  • 38.9k
53 votes
31 answers
11k views

Generate a mandelbrot fractal [closed]

Your task is to draw the mandelbrot set in ascii. It should look something like The complex number c lies in the mandelbrot set, when the sequence ...
Hannesh's user avatar
  • 1,225
49 votes
26 answers
11k views

Draw the Devil's Staircase

The Devil's Staircase is a fractal-like function related to the Cantor set. Your task is to replicate this funky function — in ASCII art! Input A single integer ...
Sp3000's user avatar
  • 61.9k
32 votes
9 answers
4k views

ASCII Art of the Day #2 - Flow Snakes

A Flow Snake, also known as a Gosper curve, is a fractal curve, growing exponentially in size with each order/iteration of a simple process. Below are the details about the construction and a few ...
Optimizer's user avatar
  • 26.5k
27 votes
4 answers
1k views

Map string to Hilbert curve

Let's map some strings to 2d space, fractal style. Your task is to compute a Hilbert curve and lay a string along it. Task The task is to take the single-line input string, and lay it out along a ...
wizzwizz4's user avatar
  • 2,377
22 votes
5 answers
6k views

"Sorry, young man, but it's Turtles all the way down!"

Execute a Lindenmayer System A Lindenmayer System (or L-system) is related to Thue and Post systems, and is used in botanical modeling and fractal generation. An L-system is described by string-...
luser droog's user avatar
  • 4,917
21 votes
13 answers
7k views

Draw a Dragon Curve

You task for today: draw a dragon curve! In case you don't know what a Dragon Curve is, here is an introductory ViHart video (Really cool, please watch!) Your task: draw a dragon curve, iterated at ...
Alecto Irene Perez's user avatar
104 votes
39 answers
20k views

Mandelbrot image in every language

I always used a Mandelbrot image as the 'graphical' version of Hello World in any graphical application I got my hands on. Now it's your guys' turn. Language must be capable of graphical output or ...
Mark Jeronimus's user avatar
49 votes
3 answers
5k views

Computer Generated Textured Wall Paint

The paint on the walls in my room has a random, almost fractal-like, 3-dimensional texture: In this challenge you will write a program that generates random images that look like they could be part ...
Calvin's Hobbies's user avatar
36 votes
10 answers
3k views

Generate fractals from bit patterns in ASCII

Overview Write a program that prints out simple fractal patterns given a bit pattern encoding the fractal, plus the per-generation scale factor of the fractal and number of generations. Explanation ...
samgak's user avatar
  • 1,677
31 votes
6 answers
3k views

Draw the Hilbert curve using slashes

The Hilbert curve is a space filling fractal that can be represented as a Lindenmayer system with successive generations that look like this: Thanks to http://www.texample.net/tikz/examples/hilbert-...
Calvin's Hobbies's user avatar
29 votes
2 answers
944 views

Hilbertify an image

I like the Hilbert Curve. Your task for this challenge is to take an image (strictly a square image where all the sides are a power of two pixels wide) and unravel it line by line in a zig-zagging ...
Wheat Wizard's user avatar
  • 98.8k
26 votes
11 answers
711 views

Binary tree fractal

Today's challenge is to draw a binary tree as beautiful ascii-art like this example: ...
DJMcMayhem's user avatar
  • 59.3k
25 votes
2 answers
1k views

ASCII Hilbert Curve

Given an integer n output the nth iteration of the Hilbert Curve in ASCII using the characters ...
Bobas_Pett's user avatar
  • 1,025
22 votes
6 answers
3k views

Koch Snowflake - codegolf

The Koch snowflake (also known as the Koch star and Koch island) is a mathematical curve and one of the earliest fractal curves to have been described. It is based on the Koch curve, which appeared in ...
gnibbler's user avatar
  • 15.1k
16 votes
8 answers
8k views

Create a fractal tree

What I would like to see is a fractal tree being drawn where the you can input an integer, and the output will be a fractal tree with the entered amount of branch steps. Rules: The fractal should be ...
joeytje50's user avatar
  • 621
15 votes
10 answers
5k views

Draw the Hilbert Curve

A Hilbert Curve is a type of space-filling curve, and it basically maps a line to a plane. Each point in the line corresponds to just one point in the plane, and each point in the plane corresponds to ...
Alecto Irene Perez's user avatar
13 votes
12 answers
3k views

Graphical Representation of Koch Snowflake

Generate a Koch Snowflake A Koch snowflake is a triangle that for each n, another equilateral point is added in the middle of each side: http://en.wikipedia.org/...
user avatar
34 votes
6 answers
1k views

Generate a Padovan Spiral

Introduction Similar to the Fibonacci Sequence, the Padovan Sequence (OEIS A000931) is a sequence of numbers that is produced by adding previous terms in the sequence. The initial values are defined ...
Andrew Li's user avatar
  • 1,071
33 votes
24 answers
3k views

The IHIH Pyramid

I find it fascinating how the letters "H" and "I" are very similar. "H" is a horizontal stroke surrounded by two vertical strokes; "I" is a vertical stroke surrounded by two horizontal strokes (...
DJMcMayhem's user avatar
  • 59.3k
30 votes
4 answers
6k views

Draw an Apollonian Gasket

Given three mutually tangent circles, we can always find two more circles which are tangent to all three of those. These two are called Apollonian circles. Note that one of the Apollonian circles ...
Martin Ender's user avatar
24 votes
20 answers
4k views

Print a Cantor Set

The Challenge Build a N-Leveled Cantor Set. The Cantor ternary set is created by repeatedly deleting the open middle thirds of a set of line segments. The program receives one parameter ...
Averroes's user avatar
  • 4,107
23 votes
12 answers
2k views

Quicksand (piles)

In this fastest-code challenge, you take a positive integer as input, which represents the height of a sand pile, located at (0,0) on an infinite square grid. For example, if our input is ...
AnttiP's user avatar
  • 7,898
23 votes
15 answers
3k views

The Cantor Function

The Cantor function is continuous everywhere and constant almost everywhere, but has an average slope of 1: The function can be found recursively: \$f_0(x)=x\$ \$f_{n+1}(x)=\left\{\begin{matrix}\frac{...
golf69's user avatar
  • 2,059
21 votes
7 answers
1k views

The strange attraction of the logistic map

The purpose of the challenge is to approximately plot the attractor of the logistic map as a function of its parameter r (also called bifurcation diagram), or a subregion of it. The appearance of the ...
Luis Mendo's user avatar
  • 105k
20 votes
13 answers
1k views

Sierpinski Layers

Starting with /\ you can create a Sierpinski triangle like pattern by adding a line beneath such that... Any loose branch / or <...
Calvin's Hobbies's user avatar
20 votes
9 answers
2k views

Is it within the Cantor set?

The Challenge For this challenge, you are supposed to determine if a given number is in the Cantor set. So first, let's define the Cantor set. First, start with the numbers between 0 and 1. Any ...
TheNumberOne's user avatar
  • 11.6k
17 votes
12 answers
627 views

Generalized Cantor set segment lengths

Problem Let's define a generalized Cantor set by iteratively deleting some rational length segments from the middle of all intervals that haven't yet been deleted, starting from a single continuous ...
Angs's user avatar
  • 4,987
16 votes
3 answers
893 views

ASCII L-system renderer

Background An L-system (or Lindenmayer system) is a parallel rewriting system that, among other things, can be easily used to model fractals. This question concerns deterministic, context-free L-...
Uri Granta's user avatar
  • 2,959
14 votes
4 answers
1k views

Draw a Random Walk with Slashes

Write a program or function that takes in a positive integer N (via stdin/command line/function arg) and prints or returns a string representation of a two dimensional random walk that is N steps long,...
Calvin's Hobbies's user avatar
7 votes
1 answer
641 views

Hilbertize an image

For a computer vision app I want to do a mapping of an image, in such a way that every pixel fit hilbert curve, instead of conventional layout. So task could be as follows: Task description Given ...
xakepp35's user avatar
  • 313
3 votes
1 answer
1k views

Draw a Fractal in Under 200 Characters [closed]

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 ...
Cameron's user avatar
  • 997