请教这个PYTHON的程序问题怎么解决..

请教这个PYTHON的程序问题怎么解决..

我是新手..看到一本书上有这个问题..但是不会做...请问有大虾帮忙解决下么..


Problem: ROBOTS

Given the dimensions of a rectangular grid and a sequence of robot positions and
instructions, you are to write a program that determines for each sequence of robot
positions and instructions the final position of the robot.
A robot position consists of a grid coordinate (a pair of integers: x-coordinate followed
by y-coordinate) and an orientation (N,S,E,W for north, south, east, and west). A robot
instruction is a string of the letters 'L', 'R', and 'F' which represent, respectively, the
instructions:

• Left: the robot turns left 90 degrees and remains on the current grid point.
• Right: the robot turns right 90 degrees and remains on the current grid point.
• Forward: the robot moves forward one grid point in the direction of the current
orientation and mantains the same orientation.
The direction North corresponds to the direction from grid point (x,y) to grid point
(x,y+1).
Since the grid is rectangular and bounded, a robot that moves ``off'' an edge of the grid is
lost forever. However, lost robots leave a robot ``scent'' that prohibits future robots from
dropping off the world at the same grid point. The scent is left at the last grid position the
robot occupied before disappearing over the edge. An instruction to move ``off'' the
world from a grid point from which a robot has been previously lost is simply ignored by
the current robot.

INPUT SPECIFICATION
The first line of input is the upper-right coordinates of the rectangular world, the lowerleft
coordinates are assumed to be 0,0.
The remaining input consists of a sequence of robot positions and instructions (two lines
per robot). A position consists of two integers specifying the initial coordinates of the
robot and an orientation (N,S,E,W), all separated by white space on one line. A robot
instruction is a string of the letters 'L', 'R', and 'F' on one line.
Each robot is processed sequentially, i.e., finishes executing the robot instructions before
the next robot begins execution. There will be 3 robots.
You may assume that all initial robot positions are within the bounds of the specified
grid. The maximum value for any coordinate is 50. All instruction strings will be less
than 100 characters in length.

OUTPUT SPECIFICATION
For each robot position/instruction in the input, the output should indicate the final grid
position and orientation of the robot. If a robot falls off the edge of the grid the word
``LOST'' should be printed after the position and orientation.
SAMPLE INPUT (from file) and OUTPUT (to file)
Case 1:
in.txt looks like this:
5 3
1 1 E
RFRFRFRF
3 2 N
FRRFLLFFRRFLL
0 3 W
LLFFFLFLFL
out.txt looks like this:
1 1 E
3 3 N LOST
2 3 S
研究了1天了..还是搞不懂啊...有人知道咩...
早上6:00就起床发贴啦
老实交代你是不是老外
在国外读书而已...买的英文版的PY的书看...但是很吃力..因为以前没接触过...所以才发贴求助啊...
好长的e文,什么书啊
你们老师布置的作业吧。。。。。
哎,你先翻译一下,总结一下在问大家,谁有功夫看这个啊
翻着字典算是把题目看完了

这个题目不难吧

简单的来说题目, 就是:
从一个文件里读数据,其中第一行是整个平面坐标系的右上点坐标,坐标原点为 0, 0; 之后每两行代表一个机器人的初始位置及它所面向的方向((N,S,E,W 分别对应北,南,东,西),以及此机器人之后的移动方法(L代表向左转,但保持原地不动,R代表向右转,也保持原地不动,F代表向前走一格)
如果某个机器人走出坐标系,则视其为LOST,同时需要将它“掉出”坐标系前的那一点坐标记录下来,以防止之后的机器人又从这里“掉出”坐标系。
最后将所有机器人的最终位置打印出来。

我的E文也不好,不知道大家能不能看懂。。。

楼主好好想想,多写写,肯定能写出来。
实在是写不出来,也把自己已经写的东西贴出来,让大家帮你看看,不要直接把题目贴出来,就等大家帮你写~
国外的教育方法就是好 出的题目都这么有吸引力  机器人