I'm implementing AI for pacman in a maze world using search algorithms like DFS , BFS , UCS and A\* . the implementing for DFS is very simple, but for BFS I'm mixed up. I don't know how to implement it , because I can't understand how could it possible that pacman start from a location and enqueue its neighbor's location and check them and go through to them. :/ can anyone help me? !