Reputation: 25
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
Upvotes: 0
Views: 80
Reputation: 590
The R and L are telling which direction to TURN, not to MOVE. So going through the example starting at 5,5.
Upvotes: 2