Herself's Artificial Intelligence

Humans, meet your replacements.

Archive for the ‘source code’ Category

Polyworld open source artificial life software

without comments

Polyworld is an evolutionary environment with simulated physics that allows you create creatures that will evolve. The creatures are free form neural networks. It was created by Larry Yaeger. They will learn to find food, become or hunt prey and mate and have children. It is open source, code is available at Source Forge ( link below ) and it does have versions for Windows, Linux and OSX.

Although we have had great success solving toy problems in artificial environments evolved creatures in virtual environments haven’t found great success in solving real world problems yet.

PolyWorld is a computational ecology that I developed to explore issues in Artificial Life. Simulated organisms reproduce sexually, fight and kill and eat each other, eat the food that grows throughout the world, and either develop successful strategies for survival or die. An organism’s entire behavioral suite (move, turn, attack, eat, mate, light) is controlled by its neural network “brain”. Each brain’s architecture–it’s neural wiring diagram–is determined from its genetic code, in terms of number, size, and composition of neural clusters (excitatory and inhibitory neurons) and the types of connections between those clusters (connection density and topological mapping). Synaptic efficacy is modulated via Hebbian learning, so, in principle, the organisms have the ability to learn during the course of their lifetimes. The organisms perceive their world through a sense of vision, provided by a computer graphic rendering of the world from each organism’s point of view. The organisms’ physiologies are also encoded genetically, so both brain and body, and thus all components of behavior, evolve over multiple generations. A variety of “species”, with varying individual and group survival strategies have emerged in various simulations, displaying such complex ethological behaviors as swarming/flocking, foraging, and attack avoidance.” ( introduction to PolyWorld: Life in a new context ( link below ))

More information:
Poly’s world
Download source code for PolyWorld

Polyworld, Yaeger ( pdf)
Computational Genetics, Physiology, Metabolism, Neural Systems, Vision and Behavior or PolyWorld: Life in a new context ( pdf)
You Tube:
PolyWorld: Google Tech Talks

Written by Linda MacPhee-Cobb

March 6th, 2008 at 5:00 am

Simple artificial life program source code

without comments

I am finishing up my reading of ‘The Magic Machine: A Handbook of Computer Sorcery‘ and there were only two programs left to write. I thought I’d wipe the first one out in a day. Heh, it took three.

In a chapter of the book the author discusses early attempts at genetically evolving artificial life. He gives a rough algorithm and states he had all kinds of critters running around in just a few hundred generations. I loosely wrote a program based on his algorithm. 150,000+ cycles, and 36 hours on my computer later, no evolution. I don’t know how he did it? I couldn’t get the algorithm in the book to produce any interesting results.

I did today get a program that has bugs that learn to stay on and follow food lines drawn in the window. It takes about 1500 days ( cycles ) for them to achieve this universally. The source code is linked to below.

Here’s what I learned in my attempts at a very simple genetic program.

If you place food randomly there is nothing to learn. You just end up with a population of stupid bugs. Adjusting the food nutrient content worked better than adjusting the amount of food for controlling population levels and for evolution. Creating more food to meet the population just created lots of stupid bugs. ( I wonder if there is a real life lesson in that? )

If you adjust the bugs DNA when they find food, not just their energy levels they learn much faster.

I hope to do some more complex and interesting evolution programs soon.

Source Code:

See also
Evolutionary AI for more information and several useful links and papers to get you started.
SantaFe Ants

Written by Linda MacPhee-Cobb

February 27th, 2008 at 5:00 am

Posted in game ai,source code

Tagged with

Source code to simulate people at a party

without comments

I’ve covered a fair bit of simulations of people in news stories and recently read a chapter on people simulations in ‘ The Magic Machine: A Handbook of Computer Sorcery‘ and thought it was time to try a simple simulation.

This source code simulates 3 groups at a party. One group has a personal comfort zone of 1 foot, one group a zone of two feet and one a zone of three feet. Each group is a different color. The people start in random locations. As the party progresses and people move about they try to keep other people at their personal comfort zone. Each person moves to the square nearest himself that maximizes the comfort zone for himself. If that is not possible the person moves to a random spot ( mingles ).

If you deduct happiness from a person when they are crowded or lonely they move more than if no happiness points are deducted. They mingle more, deducting no points the crowd is more likely to form groups.

The code is heavily commented and should be easy to follow, source code is in Java.


Written by Linda MacPhee-Cobb

February 13th, 2008 at 5:00 am

Posted in source code

Tagged with

Cellular Automata

without comments

In Wolfram’s book “A New Kind of Science” he studies cellular automata. What is also interesting is the approach he is taking. Rather than take something we know and try to figure out the rules, he tries different rules to see what they will create. While his book was badly received when it came out, other’s have found great success using this approach recently.

Wolfram was hardly the first to use cellular automata to mimick real life. Martin Gerhardt and Heike Schuster created ‘HodgePodge’ a cellular automata to mimic a chemical reaction. They explained it as using a discrete form of a differential equation. Since we have described most natural phenomena with differential equations that may explain why we have not done more with cellular automata. We just haven’t needed it. We may find use for it in things we can not yet easily describe with differential equations.

For example, cellular automata has found success in artificial intelligence in solving echohydraulics modeling problems. Cellular automata is also being used in pattern recognition, image processing, fluid mechanics and bioinformatics.

Cellular automata is simple rules repeated over and over. While one would expect simple patterns to emerge and repetitive patterns to emerge, non-repetitive and complex patterns also emerge in some cases. The two examples shown use only two colors and simple rules. Three colors leads to many more complex designs.

Nested: If either neighbor but not both neighbors in previous row are black-> color this cell black else color it white.

Irregular: If self and right neighbor in previous row are white then self is same color as left neighbor in previous row. If self and right neighbor are not both white then self is opposite color of left neighbor in previous row.

Source code:
Java automata examples

More information:
A New Kind of Science, Talk at US by Stephen Wolfram
CelLab, Cellular Automata Laboratory
A New Kind of Science ( book is available online and free)
Some of the recent controversy about Wolfram’s book
Fractal Geometry
Cellular Automata Links
An Introduction to Lindenman Systems ( related subject )
The Primordial Soup Kitchen
One dimensional cellular automata Java applet
A weakly universal cellular automaton in the hyperbolic 3D space with three states

Written by Linda MacPhee-Cobb

January 18th, 2008 at 5:00 am

Biomorphs and artificial intelligence

without comments

I hadn’t heard of Biomorphs until I started wandering through The Magic Machine: A Handbook of Computer Sorcery. I’m brushing up on math and coding now so I can do some new projects this year and this book is a fun way to do it.

[ z = z^3 + c]

[ z = sin(z) + z^2 + c ]

Biomorphs were discovered by Clifford Pickover at the IBM Research Center. Biomorphs are like Mandelbrot functions in that you iterate a simple function over the complex plane. The algorithm is in the 2 example Java files below. Several more besides these two are known to reside between -20 and 20. { z^z + z^6 + c; z^z + z^6 + c; sin(z) + e^z +c; z^5 + c; z^z + z^5 + c; . . . } You should be able to figure out how to create them by altering the two examples in the download file.

Some people breed biomorphs and let them evolve as an artificial life form.

Source Code
biomorphs.tar.gz ( 2 Java source files for the biomorphs above )

More information:
Fractal Geometry
Dr. Clifford Pickover home page
Mad Teddy’s Fractals #2 Biomorphs

Written by Linda MacPhee-Cobb

January 14th, 2008 at 5:00 am