GeneticTS / docsProject documentation

Reference

Genome Evaluation and Fitness

Look up syntax, contracts, layouts, algorithms, and exact behavior.

Each genome is evaluated by creating a fresh Matter.js engine, placing the ball at the launch point, applying the genome as initial velocity, and stepping the world for a fixed number of frames. During the replay, the simulator records the path, the minimum distance to the target, whether the ball hit the target, and when the hit occurred.

g=(vx,vy)g = (v_x, v_y)
Genome. A candidate solution is only the initial x and y velocity applied to the ball.

The fitness function strongly rewards hits, especially early hits. Misses are still ranked by closeness, with a small travel-distance tie breaker so that useful motion beats a static failure.

That discontinuity is deliberate. Near misses should guide the population before it discovers the target, but once any genome actually overlaps the target, the search should rapidly prefer true hits over merely elegant arcs. The early-hit bonus then breaks ties among successful shots by favoring simpler, faster trajectories.

Fmiss=50001+dmin⁡+0.0025min⁡(L,900)F_{\mathrm{miss}} = \frac{5000}{1 + d_{\min}} + 0.0025\min(L, 900)
Miss score. Unsuccessful attempts are scored by closest approach plus a small path-length tie breaker.
Fhit=10000+18(T−thit)F_{\mathrm{hit}} = 10000 + 18(T - t_{\mathrm{hit}})
Hit score. Successful attempts dominate misses, and faster hits rank above slower hits.