A robot is placed on the square A1 of a standard chessboard and has to reach H8. It understands orders Up, Down, Left, Right. On some squares, there might be a cement block; is such a case, the robot does not execute the order and continues with the next one on your list.

There always is at least one possible path.

The list of directions is finite.

The robot might reach the destination somewhere in the middle of your list.

Give the answer in the form UURRU.

(This list will work i.e. on an empty 3x3 chessboard or with a single block on A3 but will fail with a single block on B3.)

  • 2
    $\begingroup$ If the robot would go off the board, does it stop? If so, this seems similar to Maze Solving Robot $\endgroup$
    – xnor
    Commented Feb 3 at 1:51
  • $\begingroup$ @xnor: no, it cannot go off the board, the solution would be trivial No lateral thinking like digging a tunnel, teleportation... $\endgroup$
    – kaksi
    Commented Feb 3 at 19:00
  • $\begingroup$ @jaap It is a little bit similar, but still different. I.e. in my problem, if there is a block on B1, the robot never can occupy this square. If there is a wall between A1 and B1, it is possible that the robot goes to B1 (depending on other walls). $\endgroup$
    – kaksi
    Commented Feb 3 at 19:05
  • 5
    $\begingroup$ @kaksi But the solution given there still applies. It only uses the fact that some moves are forbidden and there are no one-way moves. If you prefer, you can think of a cement block as a square surrounded by walls. $\endgroup$
    – Florian F
    Commented Feb 3 at 21:58


Browse other questions tagged or ask your own question.