aboutsummaryrefslogtreecommitdiff
path: root/ALGORITHM.txt
blob: 5b6e00b2cb1876279f4ac0e85206d2f3254b72f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
DLA Algorithm
-------------

The algorithm works like this:

1. The initial "seed" pixels are drawn.

2. Each particle starts on the edge of a circle whose center is the
   center of the screen. The circle's radius depends on the number
   of particles that have been rendered so far: radius is 15 for
   particles 1 to 100, 30 for particles 101 to 300, 45 for particles
   301 to 600, and 75 for particles 601 and up.

3. Walk the particle around randomly. For each step, pick a random one
   of the 4 cardinal directions (no diagonals).

4. If the particle goes "out of bounds" (see below), respawn it and
   try again (without incrementing the particle counter).

5. If the particle is ever adjacent to a set pixel, it gets stuck
   there, the particle counter is incremented, and we go back to step 2.

When the particle counter reaches the max (the number the user
entered), the process is complete.