• Hits for Hunted House

Question related to mission Haunted House

Currently, I am using the BFS algorithm for obtaining a route to 'E' (Exit). While computing a possible route in each iteration, I am calculating the Ghost movements from Stephan movements. I am not sure if my approach could be considerated Brute Force. However, when I run&test the performance is stuck. It seems that the processing is too long.

Anyone can help me or give me a hint for save some processing concerning the ghost chasing condition?

Thank you in advance