I am developing a software which connects objects with wires. This wiring has a rule that these wires cannot pass on other objects and no diagonal move is accepted.
All of the shortest path algorithms that i know (A*, dijkstra etc.) find this type of paths:
I do not want the unnecessary zigzags in the second screenshot. How do i achive this goal?
Note: Anyone who want to try the algorithms can use this application.
Another Note: This is the exact situation that i do not want. It finds the zigzag path instead of the one "go to the right until the you reach x position of the target, go to the up until you reach the y position of the target" which has the same cost with the zigzagged one.