Perfect play generator of pacman in C++