Logo by Timeroot - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Visit the official fractalforums.com Youtube Channel
 
*
Welcome, Guest. Please login or register. March 28, 2024, 11:53:27 AM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: 1 2 [3] 4   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: Fractal fire and other fractal life  (Read 3160 times)
0 Members and 1 Guest are viewing this topic.
Jesse
Download Section
Fractal Schemer
*
Posts: 1013


« Reply #30 on: March 14, 2012, 06:33:13 PM »

I have heard of a faster game of life implementation with look up tables:

A 4x4 neighbourhood was used as a 16bit index, and the table contained the center 2x2 pixel results of the next generation. A lot of trickery was needed with memory layout of the pixels to do this faster than one lookup every four cycles.

These days, you could keep a 6x4 neighbourhood in a 16MB sized table, and look up a 4x2 result. The highest end CPUs do have enough cache ...

LUT would be a choice, but as you said the memory access is a problem, without special layout it would be surely not possible in a few clocks.
Another idea?  smiley
(Ok, i don't want to hijack this thread, so with a little spoiler i tell it beneith...)



















...
The solution i found (on the internet, not my idea sadly) was to treat every pixel as one bit and load 64 at once in a MMX register, adding the surrounding pixels with binary functions and additional registers (and for the next higher bit, xor to keep the reminder).
So you have n registers forming a parallel array of values up to n bits.  The outer 2 bits was calculated extra because of 1 left and right shift done.  You then have 64 clocks to get this work.
   
Logged
Tglad
Fractal Molossus
**
Posts: 703


WWW
« Reply #31 on: March 15, 2012, 12:32:51 AM »

"If it is ok for you i would like to copy your idea of layers and see if i get something interesting..."
Certainly, I'll do up a small blog post for you as the update order needs explaining.

Edit- Here it is- http://tglad.blogspot.com.au/2012/03/implementing-fractal-automata.html
« Last Edit: March 15, 2012, 01:58:21 AM by Tglad » Logged
kram1032
Fractal Senior
******
Posts: 1863


« Reply #32 on: March 15, 2012, 09:45:52 AM »

With those nice graphics, it suddenly becomes a lot more understandable what actually is going on cheesy

I had an idea just recently that might be a bit more difficult to implement and if you want to apply it into the "past" and "future" too, it probably requires more layers...

The idea is to obtain a scale-free-style but regular-ish network by giving each pixel  a random neighbourhood radius and then, from the given radius, a random rule-set.
Possibly, you could just check for the existance of radii and only do one rule-set per radius or even force-include the smaller subset rules in the bigger regions and only have those states behave differently that don't exist in smaller regions.

Other ideas would be to go into a certain pattern and such things...

Either way, this stuff is interesting and I'm curious where this goes...
Logged
asimes
Fractal Lover
**
Posts: 212



asimes
WWW
« Reply #33 on: March 15, 2012, 08:00:35 PM »

How this works makes a lot more sense to me now after you put this link with the diagram of the layers: http://tglad.blogspot.com.au/2012/03/implementing-fractal-automata.html

I was going to try to make it just for fun. I'm a fan of Conay's Game of Life but had not tried something like this, I had some questions:
- How many neighbors does each cell have? It looks like one parent, the normal eight for siblings, and four children. Just making sure though before I start (wasn't sure if the children get counted as one or four).
- As far as displaying goes, do you show every layer on top of each other or just the layer with the smallest cells?
- How many layers do you tend to use?
- How do you initialize the cells? Is it just a random chance of being alive when the program starts / resets?
- What's a ruleset you used for living / dying? It is much easier to test with something that I know is supposed to look good and not just die quickly.
Logged
Tglad
Fractal Molossus
**
Posts: 703


WWW
« Reply #34 on: March 16, 2012, 07:45:16 AM »

Enjoy trying it out  smiley and let us know any cool stuff you find... watch out, it can sometimes take a lot of searching to find something

"How many neighbors does each cell have?"
Well, you can choose however many you like... but the number of rules becomes huge quickly so better to keep to less. 1 parent, 8 siblings, itself, 4 children is a good default. My app often uses the 4 nearest parents.

"do you show every layer on top of each other or just the layer with the smallest cells?"
Just the layer with the smallest cells

"How many layers do you tend to use?"
The app images are 256*256 so 8 layers... it depends on how high res you want the images.

"How do you initialize the cells? Is it just a random chance of being alive when the program starts / resets?"
Spot on, every layer randomises its bits. Though starting from an image could look cool.

"What's a ruleset you used for living / dying?"
The simplest is probably type 2, it just counts the number of neighbours 'on' from 0 to 17 (since 4 nearest parents are used). The second image from the left when you start up the app uses the rule that the centre cell is on only if the number of neighbours is: 5,7,9,10,11,12,13,15 or 16.
« Last Edit: March 16, 2012, 07:50:51 AM by Tglad » Logged
kram1032
Fractal Senior
******
Posts: 1863


« Reply #35 on: March 16, 2012, 10:04:31 AM »

In that case, one of the simplest ways to throw in some color would be to, say, change layer 6 to blue, layer 7 to red and layer 8 to green. (Any other order would do. That choice is because of how our eyes work and possibly also how photographs work... - the blue channel usually includes the least information while the green channel usually has the most)
Logged
Jesse
Download Section
Fractal Schemer
*
Posts: 1013


« Reply #36 on: March 17, 2012, 08:36:27 PM »

Have you already told how type 7 is calculated?
Are you starting from top layer (coarse) to fine leyer using some more complex neighbouring rules?

My attempts so far had not that complex rules, ended up with 4 LUTs for on/off pixels and even/odd layers, so the original GOL can be implemented.  But nothing really new found so far... would be nicer to have something similar like type 7 animated.
« Last Edit: March 17, 2012, 10:47:32 PM by Jesse » Logged
Tglad
Fractal Molossus
**
Posts: 703


WWW
« Reply #37 on: March 18, 2012, 08:16:36 AM »

Type 7 is very tricky, I don't recommend trying it, and don't think it can be made to animate. Each type has different mapping types, but for a particular type the same rule is applied at every layer and at every location. For the statics you can just order the update from coarsest to finest.
I don't know what GOLs or LUTs are, but show us if something interesting pops up.
« Last Edit: March 18, 2012, 08:18:08 AM by Tglad » Logged
Jesse
Download Section
Fractal Schemer
*
Posts: 1013


« Reply #38 on: March 18, 2012, 11:27:32 AM »

GOL: game of life  LUT: looking up table  (for the rules based on neighbour count)

Maybe i will try also to extend the colored pixels to float values (maybe complex) and use also complex math like for mandelbrot to iterate  smiley
Logged
Alef
Fractal Supremo
*****
Posts: 1174



WWW
« Reply #39 on: March 18, 2012, 04:27:15 PM »

Maybe you should add colour as a function of time + some gradient, say starting from orange and ending with crimson, or maybe repeating solid colours in every few iteration thus generating zebra style pattern.

So the picture insides would show how picture developed. That would be more visualy appealing.
Logged

fractal catalisator
asimes
Fractal Lover
**
Posts: 212



asimes
WWW
« Reply #40 on: March 20, 2012, 06:37:54 AM »

I finished writing it in Processing if anyone wants to use it that way. Please note, I am not 100% sure my parent and child neighbor testing is correct (it is difficult to test):

Code:
float livingChance = 0.10;
int depth = 10;
int frame = 1;
boolean[] alive;
int[] cellIndex = new int[depth];

void setup() {
  size(1<<depth-1, 1<<depth-1, P2D);
  int aliveNum = 0;
  for (int i = 0; i < depth; i++) {
    aliveNum += (1<<i)*(1<<i);
    cellIndex[i] = aliveNum-(1<<i)*(1<<i);
  }
  alive = new boolean[aliveNum];
  initialize();
}

void draw() {
  String binFrame = binary(frame);
  int position = binFrame.length()-binFrame.lastIndexOf('1')-1;
  int layerToUpdate = depth-1-position;
  if (layerToUpdate < 0) {
    frame = 1;
    layerToUpdate = depth-1;
  }
  updateLayer(layerToUpdate);
  display();
  frame++;
}

void mousePressed() {
  initialize();
}

void initialize() {
  for (int i = 0; i < alive.length; i++) alive[i] = random(1) < livingChance;
}

void updateLayer(int layer) {
  int numCells = 1<<layer;
  boolean[] lives = new boolean[numCells*numCells];
  for (int i = 0; i < numCells*numCells; i++) {
    int neighbors = 0;
    int x = i%numCells;
    int y = i/numCells;

    // Parent
    if (layer > 0 && alive[cellIndex[layer-1]+x/2+y/2*(1<<layer-1)]) neighbors++;

    // Siblings
    if (y > 0) {
      if (x > 0 && alive[cellIndex[layer]+i-numCells-1]) neighbors++;
      if (alive[cellIndex[layer]+i-numCells]) neighbors++;
      if (x < numCells-1 && alive[cellIndex[layer]+i-numCells+1]) neighbors++;
    }
    if (x > 0 && alive[cellIndex[layer]+i-1]) neighbors++;
    if (alive[cellIndex[layer]+i]) neighbors++;  // Self
    if (x < numCells-1 && alive[cellIndex[layer]+i+1]) neighbors++;
    if (y < numCells-1) {
      if (x > 0 && alive[cellIndex[layer]+i+numCells-1]) neighbors++;
      if (alive[cellIndex[layer]+i+numCells]) neighbors++;
      if (x < numCells-1 && alive[cellIndex[layer]+i+numCells+1]) neighbors++;
    }

    // Children
    if (layer < depth-1) {
      if (alive[cellIndex[layer+1]+x*2+y*2*(1<<layer+1)]) neighbors++;
      if (alive[cellIndex[layer+1]+x*2+y*2*(1<<layer+1)+1]) neighbors++;
      if (alive[cellIndex[layer+1]+x*2+y*2*(1<<layer+1)+(1<<layer+1)]) neighbors++;
      if (alive[cellIndex[layer+1]+x*2+y*2*(1<<layer+1)+1+(1<<layer+1)]) neighbors++;
    }

    // Rules
    if (alive[cellIndex[layer]+i]) lives[i] = neighbors == 2 || neighbors == 4;
    else lives[i] = neighbors == 3;
  }
  for (int i = 0; i < numCells*numCells; i++) alive[cellIndex[layer]+i] = lives[i];
}

void display() {
  loadPixels();
  for (int i = 0; i < width*height; i++) {
    if (alive[cellIndex[depth-1]+i]) pixels[i] = 0xff0000;
    else pixels[i] = 0;
  }
  updatePixels();
}
Logged
asimes
Fractal Lover
**
Posts: 212



asimes
WWW
« Reply #41 on: March 20, 2012, 06:41:24 AM »

Could I bother someone to write some of the rules being used please? Experimenting with numbers is slow so far

In a form like this I would understand it:
- Num parents, num siblings (basically if self is included or not), num children
- If alive, stay alive if (THIS CONDITION OF NEIGHBORS IS MET)
- If dead, come to live if (THIS CONDITION OF NEIGHBORS IS MET)

EDIT: Woah, in my laziness to correctly code the extra 3 parents correctly I just multiplied the only parent coded by 4 (the parent that is yellow in the diagram from Tglad's website) and used rule type 2. The result was pretty cool, very excited about this one now
« Last Edit: March 20, 2012, 07:34:04 AM by asimes » Logged
asimes
Fractal Lover
**
Posts: 212



asimes
WWW
« Reply #42 on: March 20, 2012, 07:57:51 AM »

Logged
Tglad
Fractal Molossus
**
Posts: 703


WWW
« Reply #43 on: March 20, 2012, 12:04:37 PM »

Hi asimes. Your code looks like it is right... there might be typos but looks about right.
Beware of 1<<layer+1  I thought you needed to do 1<<(layer+1), but I guess not as it seems to be working for you.

Your pic looks cool, it kind of looks like it might be working as it is kind of fractal, with big loops and smaller loops.

I don't think I can give other example rules other than the one I gave, since the other types are more complex and experimental so better to make up your own... though you'd want some way to search the space of rules, you won't get far searching one at a time.
Logged
asimes
Fractal Lover
**
Posts: 212



asimes
WWW
« Reply #44 on: March 20, 2012, 09:17:13 PM »

I haven't been able to come up with rules that make fractals. However, I have gotten a lot of nice animations. Are the fractal images coming from the top layer or a deeper layer?

I have some tests here: http://alexsimes.com/FractalAutomata/

Pressing '1', '2', or '3' initializes the grids through the corresponding modulo. For example, '2' passes the grids through alive = i%2 == 0;
Logged
Pages: 1 2 [3] 4   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Fractal Patterns in early life revealed Fractals Applied or in Nature Jules Ruis 3 2832 Last post October 22, 2006, 11:24:56 PM
by rloldershaw
Fractal life Fractals Applied or in Nature marius 1 3320 Last post February 28, 2011, 11:10:45 PM
by Tglad
The first life was.... fractal Fractals Applied or in Nature Tglad 6 2140 Last post November 20, 2011, 12:15:42 PM
by jehovajah
The best way to fly through a real-life fractal Fractals Applied or in Nature Kali 2 2320 Last post June 01, 2011, 07:31:23 PM
by Kali
Real-life Ducks Fractal Fractal Humor Kali 5 3158 Last post November 15, 2011, 11:35:01 AM
by cKleinhuis

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.695 seconds with 25 queries. (Pretty URLs adds 0.036s, 2q)