Implemented most of game logic in Pacman sample