Yeah pacmans ai avoids going for pellets close to ghosts so it seems that if there are no more suitable pellets it just crashes, sorry about that
Thanks for your comment, I appreciate it :3