© Alexandre Bergel​ 2020
A. BergelAgile Artificial Intelligence in Pharohttps://doi.org/10.1007/978-1-4842-5384-7_11

11. Exiting a Maze

Alexandre Bergel1 
Santiago, Chile

Genetic algorithms are often presented as a way to solve a difficult algorithmic problem. This chapter applies a genetic algorithm to help a small robot find an exit. It formulates a simple situation (a robot looking for the exit) as an optimization problem (minimizing the distance between the robot and the exit). This chapter builds a small robot that lives in a randomly generated maze. The robot’s objective is to exit the maze.

11.1 Encoding the Robot’s Behavior

We will model the maze as a two-dimensional map, in which the maze entrance and exit are fixed positions. The entrance ...

Get Agile Artificial Intelligence in Pharo: Implementing Neural Networks, Genetic Algorithms, and Neuroevolution now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.