For your enjoyment/entertainment:
https://atariwiki.org/wiki/Wiki.jsp?page=PAC-MAN
Related there is a good Retro Game Mechanics Explained YouTube video explaining how the Pac Man algorithm works - presumably for the original arcade version. It would be good to find out if the home computer version followed the same algorithm:
-Gordon