Lab-Mouse-AI-JSXGraph is a lab mouse ai implemented in the JSXGraph library.
The ai is an evolutionary algorithm, which trys to optimize finding a way to the target point.
To run the code use a http server tool like http-server to serve the index.html.
Example using http-server:
$ http-server .
Each sphere has an array of random Vectors like [(0.48,0.12), (-0.36,0.23), …]. At the i-th step of the
animation, the vector at the i-th position is added to the velocity of the sphere. So at the beginning every
sphere moves somewhat randomly around in space.
Each sphere has a score that is determined by the distance to the target. The closer the target the higher the
score. The better the score the higher the chance to get into the next generation. Each generation consists of
600 spheres.
The next generation is generated by mixing the Vectors of the best scoring spheres with each other. So that
hopefully a new sphere is generated which is closer to the target.
The target can be dragged with the mouse. New obstacles can be generated by spanning a rectangle with two clicks of the mouse. The spheres will collide with the rectangles and stop. Every generation should get closer to the target. Eventually the spheres will hit it. Depending on the difficulty of the constellation of the obstacles it will take longer.