>>14251449Cool, I never cared about the physics behind the problem.
Answering how to get from to (assume both are positive) doing exactly :
First think that we will at least need to do 'rights' and 'ups'.
If is odd then obviously it's impossible (you can't do an odd number of moves from and end up in the same point).
Else let the answer is
iterates through the number of times you'll go 'right' and then 'left', obviously you'll also need to do 'ups' and then 'downs' then.
Of course in the physic side of the problem you'll iterate from 0 to but you'll need the above formula probably.