implemented forbidden directions check for PacMan