Yin Yang Fire (Take That Jack Ruijs)

There's an automaton called Yin Yang Fire. It was discovered about 15 years ago by one Jack Ruijs, who still refuses to share the algorithm.

http://www.ramos.nl/yyfpics.html

He had this to say about it in 2004:

Occasionally I get emails about the time it takes before anything new is mentioned on the Yin Yang Fire site and that I am egocentric and arrogant because I keep the algorithm to myself. Maybe this is true, but there is some reason for this. After discovering the Yin Yang Fire effect, I tried to contact several universities/persons that are working on the field of self organizing system / computer-algorithms etc.., but apart from a reaction from one of the greatest minds on a related field, I am still waiting for the first reaction from the "lesser" persons (talking about arrogance). I stopped the fruitless quest trying to contact other people and decided to do everything myself. I also have mixed feelings about the scientific world, I embrace the thought that although science is very beautiful, the scientific world itself is not. The greatest scientific discoveries are made by neglecting the scientific world!

I recently wrote him to see if he had changed his mind. After 15 years. He didn't respond.

Jerk. (EDIT: I really regret this language. Sorry Jack.)

It hasn't exactly been a thorn in my side, but it has been an annoyance from time to time over the last decade or so -- knowing there's a cool discovery, but the one person who knows how it works, despite having absolutely no good reason to hide it, won't share it. He thinks he's such a scientist but he acts like a crackpot. It has really really irked me (perhaps unreasonably).

So I reverse-engineered it. Here is the Processing code. I made some small untested changes so the code makes sense out of context. Just hit me up if it doesn't work right.

  // The number of states is 64. In memory they take the values 0-63.

  int me = cellsBuffer[x][y];
  int result = me;

  // cellSum is the sum of the states of the 8 neighbors plus the central cell
  // numStates = 64
  if (me * 9 + 2 >= cellSum) {
    result = result - 1;
    if (result < 0) {
      result = numStates - 1;
    }
  }
  else {
    result = me + 1;
  }

  return result;

So suck it Jack Ruijs. Now everyone knows, after 15 years of you being a douchebag.

Douchebag. (EDIT: I still protest your attitude, but the name calling was over the top. I'm really sorry.)

Comments

  • now that was funny :)

  • edited December 2014

    Here's the whole program I'm using, adapted from the cellular automaton example in the tutorials.

    // Size of cells
    // Needs to be a power of 2
    int cellSize = 1;
    
    // Number of states
    // Needs to be a power of 2
    int numStates = 64;
    int numStatesMask = numStates - 1;
    
    // Variables for timer
    int interval = 0;
    int lastRecordedTime = 0;
    
    // Lattice size
    // Need to be powers of 2
    int screenRows = 1024;
    int screenCols = 1024;
    int latticeRows = screenRows / cellSize;
    int latticeCols = screenCols / cellSize;
    int latticeRowMask = latticeRows - 1;
    int latticeColMask = latticeCols - 1;
    
    color[] stateColors;
    
    // Array of cells
    int a;
    int b;
    int[][][] cells;
    
    void setup() {
      size (screenCols, screenRows);
    
      // Color per state
      stateColors = new color[numStates];
      int redColorSteps = 256 / (numStates/2);
      int grnColorSteps = 256 / (numStates/4);
      int bluColorSteps = 256 / (numStates/4);
      int index = 0;
      for (int i = 0; i < numStates/2; i++) {
        stateColors[i] = color(index*redColorSteps+redColorSteps-1, 0, 0);
        index++;
      }
      index = 0;
      for (int i = numStates/2; i < 3*numStates/4; i++) {
        stateColors[i] = color(255, index*grnColorSteps+grnColorSteps-1, 0);
        index++;
      }
      index = 0;
      for (int i = 3*numStates/4; i < numStates; i++) {
        stateColors[i] = color(255, 255, index*bluColorSteps+bluColorSteps-1);
        index++;
      }
    
      // Instantiate array
      a = 0;
      b = 1;
      cells = new int[2][latticeCols][latticeRows];
    
      //noStroke();
    
      // Initialization of cells
      for (int x=0; x<latticeCols; x++) {
        for (int y=0; y<latticeRows; y++) {
          cells[a][x][y] = int(random(numStates));
          cells[b][x][y] = 0;
        }
      }
    
      loadPixels();
      for (int x=0; x<width; x++) {
        for (int y=0; y<height; y++) {
          pixels[x + y*width] = #000000;
        }
      }
    
      background(0); // Fill in black in case cells don't cover all the windows
    }
    
    
    void draw() {
      for (int x=0; x<latticeCols; x++) {
        for (int y=0; y<latticeRows; y++) {
          pixels[x*cellSize + y*width*cellSize] = stateColors[cells[a][x][y]];
        }
      }
      updatePixels();
    
      // Iterate if timer ticks
      if (millis()-lastRecordedTime>interval) {
        iteration();
        lastRecordedTime = millis();
      }
    }
    
    void iteration() { // When the clock ticks
      for (int x=0; x<latticeCols; x++) {
        for (int y=0; y<latticeRows; y++) {
          int cellSum = 0; // We'll count the neighbours
          int l = (x + latticeCols - 1) & latticeColMask;
          int r = (x + latticeCols + 1) & latticeColMask;
          int u = (y + latticeRows - 1) & latticeRowMask;
          int d = (y + latticeRows + 1) & latticeRowMask;
    
          cellSum = cells[a][l][u] + cells[a][x][u] + cells[a][r][u] +
                    cells[a][l][y] +                  cells[a][r][y] +
                    cells[a][l][d] + cells[a][x][d] + cells[a][r][d];
    
          int result = cells[a][x][y];
    
          if ((result << 3) + 2 >= cellSum) {
            result = (result + numStatesMask) & numStatesMask;
          }
          else {
            result++;
          }
    
          cells[b][x][y] = result;
        } // End of y loop
      } // End of x loop
    
      // This is how the two lattices swap roles
      a = b;
      b = 1 - b;
    } // End of function
    
  • looks good

Sign In or Register to comment.