//
// BlindEyes 0.1
// Random moves
//


// Variables used in the IO process
var input: array[0..3] of string;	// 4 Lines of viewing information unparsed
					// We get a maximum of 25 characters from the competition
						// enviroment, we need 2 for the newline and \0
    oppDist: integer;				// Square of the distance to the opponent (parsed)
    myMove: string;			// Buffer for the Move we do (we can do just 256 steps
						//  each turn + \0 = 257 characters)


// Variables used in the algorithm
var direction: integer;			// What is the direction we are going to move
						//  0 - straight ahead
						//  1 - right
						//  2 - backwards
						//  3 - left
    steps: integer;			// number of steps we were capable of doing in the chosen direction


begin
	// Randomize
	randomize;

	// Read first line and check whether we are the starting player
	readln(input[0]);
	if (input[0] = 'Start') then
	begin
		// We have read start so this is not the first line of viewing information
		// read that line now
		readln(input[0]);
	end;
	// if we didn't read start as first line it will be viewing information


	while true do
	begin
		// Read the remaining lines of viewing information
		readln(input[1]);
		readln(input[2]);
		readln(input[3]);

		// Read the distance to the Opponent
		readln(oppDist);

		// Code to decide move starts here
		myMove := 'T';			// Do a Turn move, this is guaranteed to be possible

		direction := trunc(4*random()) mod 4;	// Select direction to walk in
		// If there is no opening in the current side we pick the next
		while (input[direction][0] = 'W') do
		begin
			inc(direction);
			if (direction = 4) then
				direction := 0;
		end;

		// Take on step in the direction chosen
		case direction of
		0:		// forward
                        begin
		               myMove := 'F';
		               break;
                        end;
		1:		// right
                        begin
			       myMove := 'R';
		               break;
                        end;
		2:		// backwards
                        begin
			       myMove := 'T';
			       break;
                        end;
		3:		// left
                        begin
			       myMove := 'L';
			       break;
                        end;
		end;
		// make more steps until we can go left or right or meet an endwall
		steps := 1;
		while (input[direction][steps] = 'N') do	// if it isnt N it either has a gap
		begin							// or is an endwall
			myMove := myMove + 'F';
			inc(steps);
		end;
		// Code to decide move ends here

		writeln(myMove);	// Report our move back to the caiaio
		flush(output);		// make sure the software gets our output

		// Check for a quit message
		readln(input[0]);
		if (input[0] = 'Quit') then
			exit;
		// Input[0][0] is not a quit message thus it is the first line of the viewing info
		// so we are in the same state as at the begining of the loop
	end;

end.


syntax highlighted by Code2HTML, v. 0.9.1