# How to specify a robot go always right relative to itself from absolute perspective (north west east south)

I have a robot that has a start and goal position within a maze. Each point in the maze-grid is simply a Position object containing x and y. I need an algorithm that specifies the robot only moving to its relative right only using goEast, west, east and south from the perspective of the maze. There is an implementation already (with uml and mathod names) that does not support degrees or heading. Just current position, next position and then directions in absolute terms. And the logic that goes for the robor for going only to it's relative right.

• Sorry, but still there is no problem here, what you have posted is underspecified at best. We do not see uml or your problems from post or comments. If you know positions via x,y coordinates, use them for directions. If you do not know starting direction, do not have any frane of reference, the problem is only solvable via exploration (nearest obstacle vs starting position to tetrive direction), if this is not an option, the problem is unsolvable. If say starting position is 2,3, and the next position is 3,3, it was east. This coordinates tell you what is the heading.
– Evil
Jun 20 '18 at 22:36
• I do apologize for the vague problem specification, and I realize that I should have explained more. This is a uni assignment and I was afraid to be branded a cheater/to actually cheat, or to let the assignment to be found on stackoverflow. I have learned that either I fully define the problem as much as I can or I don't. It was simply too abstract in this case. In the given UML we were supposed just edit one and implement two classes, robots. But only absolute coordinates were provided. I was hesitant to ask, but as suggested here, I was also supposed to create robot's frame of reference. Jun 22 '18 at 2:41

I'm not sure what the difficulty is, here. If the robot is facing north, its right is east; if the robot is facing east, its right is south; etc.

• Need to specify that it doesn't have any directions as such. Jun 20 '18 at 18:27
• So create frame of reference. If it is facing south, keep directions as it moves.
– Evil
Jun 20 '18 at 18:30
• @Senethys Please specify the problem fully by editing the question. Jun 20 '18 at 18:41

As suggested in another comment, a viable solution would be to keep track of the heading of your object.

Your goEast function would look something like this:

while(heading != south)
turn right 90 degrees


Same thing for the rest of the directions

• There is an implementation already (with uml and mathod names) that does not support degrees or heading. Just current position, next position and then directions in absolute terms. Jun 20 '18 at 20:53