If you are using a gas rather than a liquid, it is even simpler. Just set a high pressure at the beginning and a low pressure at the end. The gas will automatically follow the steepest part of the pressure gradient. The static solution can be calculated by solving the Poisson equation. In [1] you can see a small implementation of the idea. [1] https://simulationcorner.net/maze/
This reminds me of Collaborative Diffusion https://en.wikipedia.org/wiki/Collaborative_diffusion A classic example is programming the ghosts in pacman to trap the player, which seems to require a sophisticated, collaborative strategy. Instead, a much simpler solution is to make a "pacman smell" diffuse through the maze: - The cell containing pacman has its "smell" clamped to 1 - Cells containing walls and ghosts have…
1: http://www.roguebasin.com/index.php/The_Incredible_Power_of_...