Implementing an automatic pathfinder agent for maze games

Gergo Bogacsovics
9 min readDec 30, 2020

In this article, we will finally move on from the tutorial phase of the Automating is Fun series and solve a task that many of you are probably familiar with: finding the path out of a pre-defined maze. The difficulty of this problem can vary greatly with the size and complexity of the said maze: even kids can solve the easier ones, while some are much harder and require a lot of time and commitment to solve. Not to mention the frustration you feel when you spend minutes following a given path only to find that it leads to a dead end.

There is a certain someone who could greatly benefit from an automated pathfinding agent. Source: https://www.pinterest.com/pin/341640321708820576

So to overcome this anxiety, we will develop an AI agent this time, which can find its way out of any maze, no matter how complex that may be. All we will have to do is watch how it tackles the given level. Sounds pretty magical, right? Well, sorry to disappoint you, but it is simple graph theory and classic AI. But let’s not get ahead of ourselves and talk about the environment first, which we will use to generate the mazes for us.

The environment

In the Automating is Fun series, we generally try solving problems where the environment itself is already given, instead of creating our own custom environments (e.g. simple games), to make the problem a bit harder and more realistic. Today will be no different, as we will use the MaZe online game to generate…

--

--

Gergo Bogacsovics
Gergo Bogacsovics

Written by Gergo Bogacsovics

PhD student & AI enthusiast. Owner of the ‘Automating is Fun’ Youtube channel.

No responses yet