David Brunton
Thursday, February 21, 2008
  Green Goo in Processing 0135
I'm immensely satisfied Processing's ability to make pictures. Today's installation is something I like to call Green Goo (tm). It's much the same as previous applets in that it uses local rules to update each pixel. In this one, we start with a randomly dispersed field of green stuff on a gray background. Each pixel of green stuff looks at its neighboring pixels, and asks each of them, "how many of your neighboring pixels have green stuff in them?" The pixel then tallies the results and if the results are between eight and eighteen, it stays (or turns) green itself.

The code takes some shortcuts, so the rule is less obvious than I would like, but I'm also running it on a slow laptop, so, alas, I needed a few shortcuts. The results of my noodling around can be seen here.

I'm well on my way toward having quite a gallery of these applets, with zebra stripes, coastlines, cow spots, ant tunnels, and now goo. If anyone would be interested in collaborating on making these more interesting or prettier, please drop me an email: dbrunton@gmail.com. Ha! Google catches spam so well that I can publish that here without even worrying.

--
UPDATE: Click the pic to randomize, press space to start the goo gooing.

Labels: , , ,

 
Monday, January 28, 2008
  Brownian Motion Mash Up
So, after reading dchud's post about the last applet, I got thinking about various mash-ups I could, well, mash.

I'm still playing around with some variations on clustering and obstacles (something he mentioned in conversation), but realized I needed to make the original a little bit dumber before making it any smarter. Thus, I have replaced the previous applet's behavior of moving cells that are over the threshold to a random location. Now, instead, they move Brownian style. Any cell over its threshold simply swaps with a random pick of the eight cells adjacent to it.

Interestingly, it results in a whole new class of pictures.

Actually, I adjusted the ratio of green/magenta cells to be exactly equal, and removed the "empty" cells, since theres no need of them in the Brownian motion context.

The results are here.

The applet works the same as the other- click to randomize, space to start. It takes a lot longer to settle into a fully stable state, but there are obvious structures only a few generations in. I think it looks kind of like an ant farm.

Labels: , , , , ,

 
Friday, January 25, 2008
  Fun With Processing Language
I've been getting asked a lot (at least twice) about why this site isn't updated more frequently. There are three reasons, really. The first is that I've been doing a lot of writing with a pencil, on paper. I know, shocking. The second is that I've been doing some work on physical things (e.g. soldering iron, circuits, and wood. Yes, the kind of wood that's made from trees). And the last is that it took me a while to figure out how to put Processing Applets on the site. I know, I'm supposed to be good with computers.

The applet I'm about to show you is inspired by a paper written in 1971 by Thomas Schelling, called Dynamic Models of Segregation. It turns out that Schelling's model is a great example of sociology (in which I have a degree) and cellular automata (about which I have an obsession) working together. I'm hardly the first person to notice this.

The basic gist of the program is: there are green cells, magenta cells, and "vacant" cells (white). Each of the green and magenta cells have what I deemed a "socially acceptable" preference for living nearby one another. Specifically, each green cell wants to be in a neighborhood (defined as the cells within three pixels radius) that is at least 1/3 green. Same goes for magenta. If any cell finds this preference violated, it moves to a random empty cell.

The behavior of the system is totally different than the (expected) behavior of an individual. The system segregates quite nicely into green and magenta regions, with a vacant white border in-between. This phenomenon is called emergence. A system displays emergence if its behavior differs from the behavior of its components. Equally as important as the philosophical lesson this applet can teach, is that it makes pretty pictures.

Click the mouse to randomize the picture, and press the space bar to get it going again. It will run on its own the first time through. If you're running Internet Explorer, you may need to click through a few dire warnings to get Java to run.

Without further ado, the Schelling Applet.

Labels: , , , , ,

 
A journal covering primarily technical topics.

Name: David Brunton
Location: Washington, DC, United States
Archives
January 2007 / February 2007 / March 2007 / April 2007 / May 2007 / June 2007 / July 2007 / August 2007 / September 2007 / December 2007 / January 2008 / February 2008 / March 2008 / April 2008 /


Powered by Blogger

Subscribe to
Posts [Atom]