I am currently working on a Pacman AI heuristic, and have run into some trouble which involves Pacman becoming "trapped" between two ghosts.
I need some way, given a board state with any useful information provided (coordinates + direction of all agents, wall locations, food location, etc.), to tell if Pacman is trapped between two oncoming ghosts and is guaranteed to die within some n moves, i.e. this board state is unwinnable. (This is assuming ghosts can only turn 90 degrees- so if going North, a ghost's possible moves are either North, East or West providing no walls are in the way)
An example image: