Generation: 0 | Best Error: 0
Events: Landed: 0 | Crashed: 0 | Timed Out: 0 | Total: 0
Status: Inactive
Movement & Control: Each rocket applies a "DNA" force (a predetermined control vector) each frame, along with added forces from gravity and wind. A rocket is considered "landed" if it lands close to the landing pad (within 10 pixels horizontally and near the bottom of the canvas) and "crashed" if it collides with an obstacle or leaves the canvas. If time runs out, it is marked as "timed out."
Fitness & Error Calculation: The fitness of a rocket is based on its error (i.e., distance from the landing pad). Previously, the error was calculated as the horizontal difference from Landing X. It is now computed as the Euclidean distance from the rocket's current position to the center of the landing pad at (landingX, canvas.height – 20). Hence: error = √[(rocket.pos.x – landingX)² + (rocket.pos.y – (canvas.height – 20))²]. This trigonometric approach provides a more accurate assessment of how far each rocket is from the target landing area.
Genetic Algorithm: When 25 rockets finish (land, crash, or time out), their fitness values are calculated, the best performers are selected, and a new generation is automatically produced. This simulation is inspired by the stochastic control concepts of Lars Blackmore at MIT. However, it is simplified by ignoring certain factors (such as atmospheric variations, engine thrust variations, and rocket angle compensation) while taking into account wind speed and gravity.