GeneticTS / docsProject documentation

Reference

Physics Model and Termination

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

The simulator treats every candidate as a deterministic rollout in the same bounded world. A Matter.js engine is constructed per genome, gravity and wind are combined into one field vector, four walls are inserted with restitution, and the ball is launched from a fixed point. The engine advances at 60 Hz until the candidate hits the target, exhausts the frame budget, settles on the floor, or bounces enough times that the attempt no longer carries useful search information.

a⃗=(0,g)+w(cos⁡θ,sin⁡θ)\vec{a} = (0, g) + w(\cos\theta, \sin\theta)
Net field. Gravity strength and wind controls combine into the acceleration field assigned to the Matter.js engine.
genome (vx, vy)
  |
  v
fresh Matter.js engine
  |
  v
apply net field + walls + ball velocity
  |
  v
step frames -> record path, distance, contacts
  |
  +-- target overlap -> hit score
  +-- rest / bounce / frame cap -> miss score
Evaluation loop. Each genome receives an isolated physics replay so cross-candidate state cannot leak into fitness.
dt=∥pt−q∥2−(rtarget+rball)d_t = \lVert p_t - q \rVert_2 - (r_{target} + r_{ball})
Target overlap. A hit occurs when the signed clearance between the ball center and target center is non-positive.

The default frame budget is 200 steps. Rest detection stops attempts that reach the floor with velocity below the configured tolerance for consecutive frames. Wall-contact counting stops degenerate attempts that repeatedly bounce around the boundary instead of expressing a useful launch strategy.