Skip to content

A self-learning A.I. that learns to traverse through a maze by the genetic algorithm.

Notifications You must be signed in to change notification settings

Francis220/Maze-AI

Repository files navigation

Maze AI

An A.I. that learns to traverse a maze using the genetic algorithm.

Using a genetic algorithm, the A.I. masters navigating the maze by drawing inspiration from the principles of natural selection and survival of the fittest. Initially, we begin with a randomly chosen generation of A.I. agents. Their success in the maze is determined by who can cover the shortest distance to a checkpoint using the fewest moves. To hone their skills, the number of moves they can make is expanded every five generations. This allows the A.I. to build on past experiences and transfer efficiency traits to upcoming generations.

Typically, the A.I. takes around 50 generations to hit the first checkpoint at an evolution speed setting of 6. It requires roughly 120 generations to reach the subsequent checkpoint, and the pattern continues. Though the learning curve is gradual, the A.I. eventually succeeds, never failing to hit a checkpoint or getting defeated by adversaries. To put things in perspective, our evolutionary journey spanned 8 million years, so extend some patience to our Maze A.I.

The A.I: The starting little square represents the 'elite' of the generation. To view the entire generation, simply hit the SPACE key. Evolution Cycle Adjustments: You can modify the population size (to increase or decrease the probability of a superior fit), mutation rate (indicating how much the A.I. strays from the standard), and evolution pace (to speed up the process; consider setting it to 6 for a brisker pace). Additionally, there's an option to enhance the move count every few generations, with a suggested increment of 5 moves every 5 generations. Play yourself: Press P to try the maze yourself. Given the evolutionary advantages humans possess, it should be a breeze. Yet, after observing the A.I. clear the game, you might find it's less error-prone than you. Relive the Evolution: Press G to revisit key moments from the A.I.'s evolution journey.

Screen Shot 2023-08-18 at 3 31 29 PM

About

A self-learning A.I. that learns to traverse through a maze by the genetic algorithm.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published