This applet lets you create art using a genetic algorithm. It generates a random mathematical function and displays an image representing the function in the centre square. It also generates twelve random variations on the image, displayed in the squares around the outside. Click on the centre square to create new variations, or on one of the small images to move that image to the centre and create variations on it. Press the "Zoom" button to see the centre image displayed larger in a new window. Press the "Tree" button to show or hide the function tree (or at least as much as will fit) of the centre function.
See a gallery of pictures created with this applet.
This applet is (like all my stuff) still under development. At present there is too much variation in the child images - they often don't bear any similarity to the parent. There's a lot of tweaking of parameters to be done to get the mutation rate right. Other things which need to be done are to implement crossover between images and determine a good mix of mathematical functions to choose from. There should also be a way to save your art.
How does it work?
The applet builds a tree representing a mathematical function, with one node per function, leaf nodes being variables such as X, or Y, or numbers. This function is then randomly called to determine its probable range and then normalized to that range so you actually get valid colors. The function is then called for every pixel in the image to calculate the color of the pixel. There are two sorts of node: color nodes and numeric nodes. A color node returns a color when evaluated, a numeric node returns a numeric value. The root node is always a color node, but nodes below this will usually be numeric. For example, one sort of color node calls three numeric nodes to determine the red, green and blue components. Another calls a single numeric node and looks the result up in a color map. The mysterious "N" function you may see is a normalising function which samples its child function to determine its likely range and normalises it to between 0 and 1.
Mutation is done by traversing the tree and probabilistically changing parameters or type of a node or by pruning the tree at any point and replacing the pruned part with a new random subtree.