Free roaming maze NPC question

Can you make an npc travel a maze, and take the best route to the player?

You could make it avoid blocks and still aim towards the player

The simplest way is to make it so that the NPC changes direction every time it hits a wall in a certain direction. The hardest, but the best, way is to use raycasts, expressions, extractors (or proximity), and filters to create a pathfinding system to help the NPC navigate the maze while following the player.

Ok. That might take me a few weeks, but I can get used to it.
thanks!