Original Post
Thought I'd share what a long-time forum lurker has produced. This is a highly modified version of Roger Alsing's Method of art produced with a genetic algorithm. Alsing's exact execution may not be totally considered "GA", which inspired me to work on a more GA type implementation. The screenshots below highlight a variety of stages in implementation, but at "current spec" here's the major differences between my implementation and Alsing's. - Different plugins for the "artist", the "pool", and the "fitness" - The fitness module assigns a score to a Bitmap object generated by an artist. The artist produces an image (probably, but not necessarily, created by genes) and the pool manages artists, and decides based on their score what to do with them. By implementing these as plugins, I was able to experiment, very easily with different ideas while maintaining some core functionality that was totally isolated from the component I was working on.
- "Bastardized Annealing"
Simulated Annealing is half implemented by a combination between the "experimental artist" module and the "multi pool" module. While not a strict interpretation of the algorithm, here is how it is approximated: Within the artist, individuals "genes" (a drawing expression, a shape and its description) have a temperature which gradually cools. The temperature, when hot, allows the gene to bounce around a lot, move to more places on the canvas, have greater variety in colour and so forth. Within the gene pool module, there is a function - e(x,b) = sqrt( (1/x) + 1/3(1/b) ) - which determines the probability that a less efficient "solution" (artist) will be chosen, where x is the the absolute difference between the score of the best winner of a given generation and the current "elitist selected" winner, and b is the score of the "elitist" winner. - Extended Primitives
The drawing expressions in the AST that I developed allow for curves, polygons, and outlined shapes. Additionally, the rotation of the expression can be mutated, as can the scale and origin. - Gene Momentum
Individual branches of the AST can remember how they previously mutated. In the future, if that gene is called to mutate by the from the mutation method (mutations are called by the clone and child creation methods, and can be invoked directly by the pool.) it will tend to, though not necessarily, mutate in the same direction it has previously mutated - "Gravy" Colour
In order to improve how the artist assigns colours, I created a colour space which I called gravy-space (because I couldn't think of a better word) that had more colour-family oriented transitions, rather than being very logical like RGB. I considered using HSV but since this is a rather experimental project, I decided to experiment with colour spaces as well. The conversion from gravy colour to rgba is as follows (gravy colour has four components, ABC and D): gravy_r = a / (1-(d*0.999)) / b ^ (c*d) gravy_g = b / (1-(d*0.999)) / c ^ (a*d) gravy_b = c / (1-(d*0.999)) / a ^ (b*d) gravy_a = d The 0.999 is obviously a repeated nine. It is approximated for the sake of appeasing the computer.
Note - For the above image, a technique was employed whereby after a substantial amount of time where the GA was unable to find an improved solution with the maximum number of drawing expressions (which varies, with some noise) it would dump the output to a buffer, and then draw "on top" of its buffer, leading to some interesting layering effects. Both images above were produced with a very old version of the program.
This is Albert Hofmann. A major inspiration for just about everything I do in a given day.
An incomplete portrait of Carl Sagan.
And a rather terrifying cat. Long story short: GDNet has always inspired me to code. When I work my crappy desk job and browse away for the odd minute or too, read a post by some of the crazy coders around here I am inspired. Sure, the genius programmer may be a myth, but I think there's a few lurking around here who are close. And by that token, I would like to say that my code is not perfect. My math is mostly self-taught. I am learning, about math, programming, life in a corporate world, how to get ahead in advertising.... how to deal with life when you're on psychedelic mushrooms posting on GDNet for the first time...... But seriously, if people are interested in this sort of thing, I'd love to open my code up. The plugin framework might not be good enough for a genius, but it's good enough for me, and probably good enough for you too if you want to mess around with the host program. (But you'll have to believe me when I say although I've written many plugins for my own host, only a couple are completely compliant) I'm just not sure of the avenue, and not sure of the audience. If an audience exists, maybe they can point me to the right avenue. Peace out.




