• OK, it's on.
  • Please note that many, many Email Addresses used for spam, are not accepted at registration. Select a respectable Free email.
  • Done now. Domine miserere nobis.

Node network

Black Rose

An unbreakable bond
Local time
Yesterday 7:21 PM
Joined
Apr 4, 2010
Messages
10,871
-->
Location
with mama
This is a picture from the code in the spoiler. I would like your opinion on what it represents as a computational construct. Currently it has no learning rules and is a little bit blurry as a png file.

picture.php


Code:
import java.util.Random;
import javax.swing.JFrame;
import javax.swing.JComponent;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Color;

public class Colors extends JComponent implements Runnable {
    int[][] Data1 = new int[300][300];
    int[][] Data2 = new int[300][300];

    public Colors() {
    	generateData();
        new Thread(this).start();
    }

    public void run() {
        while (true) {
              repaint();
              changeData();
              try {
                  Thread.sleep(17);
              }
              catch (InterruptedException e) {}
        }
      }

    public void generateData() {
    	Random generator = new Random();

        for (int x=0; x<300; x++) {
            for (int y=0; y<300; y++) {
            	Data1[x][y] = generator.nextInt(255);
            	Data2[x][y] = generator.nextInt(255);
            }
        }
    }

    public void changeData() {

    	Random generator = new Random();

        for (int x = 1; x < 299; x++) {
             for (int y = 1; y < 299; y++) {
                 Data1[x][y] = (Data2[x-1][y-1]+
                         Data2[x][y-1]+
                         Data2[x][y+1]+
                         Data2[x-1][y]+
                         Data2[x-1][y+1]+
                         Data2[x+1][y]+
                         Data2[x+1][y-1]+
                         Data2[x+1][y+1])/9;

                 if(Data1[x][y]>=Data2[x][y]){
                 	Data2[x][y]=Data1[x][y];
                 }else{
            		Data2[x][y] = generator.nextInt(255);
                 }
            }
        }
        for (int x = 1; x < 299; x++) {
             for (int y = 1; y < 299; y++) {
                 Data2[x][y] = (Data1[x-1][y-1]+
                         Data1[x][y-1]+
                         Data1[x][y+1]+
                         Data1[x-1][y]+
                         Data1[x-1][y+1]+
                         Data1[x+1][y]+
                         Data1[x+1][y-1]+
                         Data1[x+1][y+1])/9;

                 if(Data2[x][y]>=Data1[x][y]){
                 	Data1[x][y]=Data2[x][y];
                 }else{
                 Data1[x][y] = generator.nextInt(255);
                 }
            }
        }
    }

	public void paint(Graphics g) {
        for (int x = 0; x < 300; x++) {
             for (int y = 0; y < 300; y++) {
                 g.setColor(new Color(0,Data1[x][y],0));
                 g.fillRect(x, y, 1, 1);
                 g.setColor(new Color(0,0,0));
                 g.drawRect(0, 0, 299, 299);
             }
        }
    }

	public static void main(String[] args) {
        JFrame f = new JFrame("Colors");
        f.add(new Colors());
        f.setSize(333, 328);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setVisible(true);
	}
}
 

walfin

Democrazy
Local time
Today 9:21 AM
Joined
Mar 3, 2008
Messages
2,436
-->
Location
/dev/null
1. You are averaging the pixels around each pixel? But you are dividing by 9, not 8. Is that intentional?
2. Suggest using BufferedImage rather than 1x1 fillRect calls.

Not sure what you're trying to represent though. A population with a hidden influence?
 

Black Rose

An unbreakable bond
Local time
Yesterday 7:21 PM
Joined
Apr 4, 2010
Messages
10,871
-->
Location
with mama
1. You are averaging the pixels around each pixel? But you are dividing by 9, not 8. Is that intentional?
2. Suggest using BufferedImage rather than 1x1 fillRect calls.

Not sure what you're trying to represent though. A population with a hidden influence?

I find that when I run the program as is it reminds me of neural spiking. If run with 8 instead of 9 it looks like mold. I'm not a programmer so this as far as I can go.

I mostly don't know how to serialize my ideas. They are all parallelised and visual.
 
Top Bottom