javagridcoordinatesdiscrete-mathematicsmap-directions

15 by 15 coordinate finding output


I've been given a programing task to complete. Find the end coordinate location when given a start point heading north and using simple commands left, right and forward.

A example scenario which was provided is as follows:

Starting input 5,5 RFLFRFLF and the output position the task says to be is 7,7 however I do not get that answer when simply doing it by hand.

Any suggestions in how they got the outcome coordinate to be 7,7


Solution

  • The R and L are telling which direction to TURN, not to MOVE. So going through the example starting at 5,5.