pacman game logic