!! Let it train for a few generations before you judge it! !! A population of agents evolves to play Flappy Bird via a standard generational GA. Each individual's policy is a linear controller over 4 parameters (w1, w2, w3, b1), producing a binary flap decision each frame: flap = (w1·dx + w2·dy + w3·vy + b1) > 0 where dx/dy are the horizontal/vertical distance to the nearest pipe gap and vy is vertical velocity. Fitness is measured as frames survived. At the end of each generation, the population is regenerated via tournament selection, uniform crossover, and per-gene mutation. Click the green flag to initialize generation 0.
Parameters (update effects each generation): N: population size per generation. Larger N increases genetic diversity and search coverage at the cost of per-generation compute (each individual is a simulated clone). Typical range: 10–30. DO NOT bring above 295 or pipes will no longer generate. tournament_size: number of individuals sampled per selection event; the highest-fitness sample wins and becomes a parent. Controls selection pressure. Low values (2) approximate weaker selection and preserve diversity longer; high values (≥5 relative to a small N) increase convergence speed but raise the risk of premature convergence to a local optimum. Recommended: ~3 for small N, or 20–30% of N for larger populations. mutation_rate: per-gene probability (%) that a value is perturbed by a random delta rather than inherited unmodified. Functions as the exploration term against selection's exploitation. Too low: stagnation once diversity is exhausted; too high: search degenerates toward random sampling of gene space. Recommended range: 5–30%.