Simulator program for a robot designed to move packages around in a warehouse
I need advice on how to start this programming project. Any advice/help will be very appriciated as it is due very soon and unfortunately programming is not one of my strongest points.
The task for the project is to write a simulator program for a robot designed to move packages around in a warehouse environment.
The input to the program (from standard input) will contain a map of the environment in its original state, together with a sequence of instructions to be performed by the robot.
The map specifies the size (40 by 80 max), shape and initial positions of all the packages in the environment, as well as the positions of the walls, and the initial position and orientation of the robot.
The walls will be represented by the "star" character *. The robot will be represented by the characters ^,v,> or < depending on whether it is facing up, down, left or right. There will be at most 26 "packages" in the environment, labeled with the letters A,B, etc. (packages may vary in size and shape).
Robot control commands
The robot is capable of four basic operations, as follows:
L turn left
R turn right
F (try to) move forward
P print the state of the environment
The instructions for the robot will consist of an ordered sequence of these four basic instructions L,R,F,P, enclosed in parentheses.
eg:
(FFFFFRFFFLFRFFFFRFFPLFFFRFRFFFFFFFFFFFFFP)
When it executes an L or R instruction, the robot remains in the same location and only its orientation changes. When it executes the F instruction, the robot attempts to move a single step in whichever direction it is pointing.
If there is a package immediately in front of the robot when it tries to move forward, the package will move with the robot (in the same direction). If there are one or more packages immediately in front of that package, they will also move, as well the packages immediately in front of them, etc. We assume the robot is strong enough to push any number of packages in front of it. Since the walls are immovable, however, there will be some situations where the robot tries to move forward but fails. This will happen if there is a wall immediately in front of the robot, or if there is a wall immediately in front of a package being pushed by the robot (either directly or indirectly). In these cases, the F instruction has no effect on the environment, and the robot continues to the next instruction. (Part of the challenge of the project is to determine which packages are being pushed, and whether or not a wall is being pushed.)
The robot leaves a trail behind it wherever it goes. So, when the environment is printed, places where there is no package or wall should be indicated by a dot '.' if the robot has been there at some time during its path, and a blank space ' ' otherwise.
Cheers,
Denise