Home▸Algorithms & AI▸Genetic Algorithm — 2D Obstacle Course Navigator

Genetic Algorithm — 2D Obstacle Course Navigator

A real 2D genetic algorithm: a population of chromosomes, each encoding a sequence of steering moves, is decoded into a path across an obstacle course, scored by a real fitness function, and evolved generation after generation with tournament selection, single-point crossover and per-gene mutation. Watch the population's best and average fitness climb on a live chart as its paths straighten out and start reaching the goal.

Algorithms & AI2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
2d-genetic ↗ Open standalone

This is the 2D companion to the 3D Genetic Algorithm simulation: a completely different task solved by the same encode → select → crossover → mutate loop. Instead of evolving a target string or climbing a fitness landscape, this version evolves a real navigation controller — a chromosome of 70 steering genes decoded into a walked path across an obstacle course. Every generation, the whole population is scored by a genuine fitness function that rewards reaching the goal quickly and penalises crashing into an obstacle, the fittest individuals are picked by tournament selection, bred with single-point crossover, and mutated gene-by-gene. Click the course to add or remove obstacles and watch the population re-adapt.

⚙ Under the hood

A real 2D genetic algorithm: chromosomes of 70 steering genes are decoded into walked paths across an obstacle course, scored by a genuine fitness function, and evolved with tournament selection, single-point crossover and per-gene mutation while a live chart tracks best and average fitness across generations.

genetic algorithmevolutionary computationtournament selectioncrossovermutationobstacle avoidancepath planning2d

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)