Fractal Image

Java

General
Home Page
About Me
Gryphon's Jokes
Fractal Images
Air Attack
About Air Attack
Dogfight Animation
3D Planes Illusion
Flight Tips
Tactical Test
Jedi Squadron
Games
Warcraft 2 Clan
Doom
Programming
Java - Artificial Life
Lotus 123 Scripts
Casio Graphic Calculator
AI Wars
QBASIC
ICQ
If you have not yet seen it watch the animation. It is one of my most recent creations. When I started it I knew next to nothing about Java so I did it mostly as an exercise for myself. It turned out not to be very difficult as Java is very like C.

The code itself is surprisingly simple: It is all in the HTML file and you can look at it by selecting 'Source' from the 'View' menu in Internet Explorer. The actual animation uses Dynamic HTML, which is supported by IE4 onwards. DHTML allows you to manipulate HTML elements (e.g. the <IMG> tag) using JavaScript.

One of the more interesting programs I made with Delphi was an artificial life simulator. There was a two dimentional array of 'cells' and each cell would either reproduce, do nothing or die, depending on how many cells were next to it. The cells were supposed to approximate a colony of single cell life forms. It is a variation on Conway's game of life.

Instead of putting it here for you to download I decided to re-write it as a Java applet. This is partly for your convenience but mostly because I am learning Java and it was a good exercise for me. If you came here before July 6th you'll notice that it has changed. I have added a second mode which allows for many more interesting colonies. Also the applet draws to the screen better and putting down new cells is easier.

Once the applet has loaded you will see a blue area on the left and a control panel on the right. Click several times somewhere in the middle of the blue to create a small patch of green. These are the cells. Click on 'Unpause' to start the simulation. You can change what the cells do (depending on the number of cells next to them) by clicking on the values in the right hand column of the table. Click where it says 'Cell type 1' to change to the new variation. Try experimenting with different values - there are 486 possible combinations. To clear the area and start again just set every value to 'Die'.

Whenever a cell reproduces it fills the four adjacent spaces with new cells. If you change the cell type to 2 then the reproducing cell dies. This seems like a minor change but it has a huge effect. With cell type 2 it is possible to create many more interesting colonies.

Click here for the source code. I don't mind if you use it for your own purposes but please acknowledge me if you do.