Hide

Problem B
Robot Turtles

/problems/robotturtles/file/statement/en/img-0001.jpg

Robot Turtles is one of Theta’s favorite games. In this game, kindergarteners learn how to “code” by creating programs that move a turtle from a starting field to a diamond. Robot Turtles is reportedly the most successful game funded by the Kickstarter incubator.

Players must develop a program consisting of “instructions” that brings a turtle from a starting location to a goal (a diamond). An adult will then “execute” this program by moving the turtle based on the given instructions.

Robot Turtles is played on an $8 \times 8$ board. There is one turtle (marked with the letter T), which always starts out at the bottom-left field, facing right. The board contains empty squares (marked as .), castles made out of rock (C), and castles made out of ice (I). The diamond is marked with a D. The turtle may move only onto empty squares and the square on which the diamond is located.

A turtle program contains $4$ kinds of instructions, marked by a single letter.

  • F The turtle moves one field forward in the direction it is facing. If the turtle faces a castle or the border of the board, a program error occurs.

  • R The turtle turns $90$ degrees to the right (the turtle will just turn and stay on the same field).

  • L The turtle turns $90$ degrees to the left (the turtle will just turn and stay on the same field).

  • X The turtle fires a laser in the direction it is facing. If the square it is facing contains an ice castle, the ice castle will melt and the square will turn into an empty square. Otherwise, a program error occurs. The turtle will not move or change direction. It is a program error to fire the laser at empty squares, rock castles or outside the board.

Input

The input consists of $8$ lines, which represents the board, with each line representing one row. The turtle will always start out at the bottom-left. There will be exactly $1$ diamond. There will be no more than $10$ ice castles.

Output

Output the shortest valid turtle program whose execution (without program error) brings the turtle from the starting location to the diamond! If there are multiple such programs of equal length, you may output any of them!

Output no solution if it is not possible for the turtle to reach the diamond!

Sample Input 1 Sample Output 1
........
........
........
...CC...
..C.DC..
.C..C...
C.IC....
T.C.....
FLFRXFLFRFLFRF
Sample Input 2 Sample Output 2
........
........
........
...CC...
..CIDC..
.CI.C...
C.IC....
T.C.....
FLFRXFLXFRFLXFRF
Sample Input 3 Sample Output 3
........
........
........
...CCD..
..C..C..
.C..I...
C.IC....
T.C.....
FLFRXFLFRFXFFFLFFLF
Sample Input 4 Sample Output 4
........
........
........
CCCCC...
..C.DC..
..C.C...
C.IC....
T.C.....
no solution

Please log in to submit a solution to this problem

Log in