A maze is a 10x10 grid square where some pairs of adjacent nodes are connected by a "wall" segment, such that it is possible to visit all grid cells by moving from one cell to an adjacent cell through the sides and without passing through walls. The boundary of the square is also considered to be surrounded by walls. In some cell of a certain maze, there is a robot. It understands 4 commands - L, R, U, D, to move left, right, up, and down respectively, and if there is a "wall" in front of it, it stays on the spot. How can a program be written for the robot so that it visits all cells regardless of the maze configuration and its starting position?