First I would like to inform you that I'm french and 15 so my english is not very good.
I've read some articles about genetic algorithms (GA) and since I discovered the HTML5's canvas element, I can create an AI with animations, so I've created two little experiments to enjoy seeing robots moving on their own but first I'll present you the second one because it's easier :
The aim of this experiment for the white circles is to touch the red square and instead of using coordinate calculations, like I said, I would like to create an autonomous algorithm which evolves in the time.
I give to the circles their relative coordinates to the red square like so they know exactly where they are and their speed that they will be able to change.
So to do it I need a solution to create a chromosome that contains moving informations but since the x and y positions are randomly assigned to circles and the square, if a member of the population has the good solution, it's only for this particular configuration.
I'm searching how to make them know that if the x coordinate is inferior to 0, they have to go left without creating a function like this if(firstGeneInfo == 2){bot[i].x += redSquare.x - bot[i].x;}
.
This is a screenshot of the canvas :
And the jsfiddle link but movements are random for the moment.
The other experiment is a sort of "survival game" where the red square has to last, first I created it as a human-AI experience but I prefer to do an AI vs AI game, and so implement a genetic algorithm but in this case it is a lot more complicated because they are multiple enemies, I thought that with informations like enemies's coordinates and speed once again, the red square would developp kind of a strategy. The enemies are controlled by an algorithm and there is no need to do a GA for them.
A screenshot :
and the jsfiddle link : http://jsfiddle.net/f6ghk/
If you've read all this, I already thank you ! I'm not asking for the full working code but just the principle of a chromosome that works in theses cases.
I hope that my english wasn't to horrible to read and that for my problems I don't need a simulated neural network because it seems a bit complicated to me.
Thank you for your answers !