0

Choosing fastest path to a point

I'm trying to make a program that will predict which directions to turn and get to a certain point by testing the directions and get the distance between the point and the program.The program will then choose the direction with the minimun distance and turn to that direction. When I first thought of this idea, I thought this was easy enough to do. However, that was easier said than done, as I'm struggling to find what I'm doing wrong or what I'm missing with it. Enough of that,here are the problems: 1.The program only turns one direction,making the program turn in a circle 2.The program would turn to the other direction when it's close to the point 3.I had an idea of making the program check the previous distance, but I had no idea on how to implement it at all. Here is the code: https://code.sololearn.com/WnYqO6eVJK5H/?ref=app

18th Aug 2020, 2:54 PM
Boay.JS
Boay.JS - avatar
6 ответов
0
DBoayy Fixed it. Check my profile.
18th Aug 2020, 7:44 PM
Midhun Madhu
Midhun Madhu - avatar
0
We'll be needing more details than what you've provided. The shortest path between two points is always a straight line. Are you looking for a straight line path or something else?
18th Aug 2020, 3:05 PM
Midhun Madhu
Midhun Madhu - avatar
0
QUICK UPDATE:Added more details
18th Aug 2020, 3:10 PM
Boay.JS
Boay.JS - avatar
0
Midhun Madhu I'm looking for the shortest path by turning to a certain direction and the program will keep moving.Also,the point is also moving the same as the program,just that it only moves in a circle. For the directions,-1 is counterclockwise,0 is forward(no rotation) and 1 is clockwise. I'm really not good at explaining things so I'm probably missing more details as well.
18th Aug 2020, 3:16 PM
Boay.JS
Boay.JS - avatar
0
DBoayy Explain directions array. What do you mean by -1,1,0 as directions? It isn't making sense.
18th Aug 2020, 5:07 PM
Midhun Madhu
Midhun Madhu - avatar