path-finding

How to use the A* path finding algorithm on a grid less 2D plane?

不羁的心 提交于 2021-02-07 08:16:52
问题 How can I implement the A* algorithm on a gridless 2D plane with no nodes or cells? I need the object to maneuver around a relatively high number of static and moving obstacles in the way of the goal. My current implementation is to create eight points around the object and treat them as the centers of imaginary adjacent squares that might be a potential position for the object. Then I calculate the heuristic function for each and select the best. The distances between the starting point and

How to use the A* path finding algorithm on a grid less 2D plane?

大兔子大兔子 提交于 2021-02-07 08:14:02
问题 How can I implement the A* algorithm on a gridless 2D plane with no nodes or cells? I need the object to maneuver around a relatively high number of static and moving obstacles in the way of the goal. My current implementation is to create eight points around the object and treat them as the centers of imaginary adjacent squares that might be a potential position for the object. Then I calculate the heuristic function for each and select the best. The distances between the starting point and

Custom made a* Path finding isn't working very well

我们两清 提交于 2021-02-05 09:46:53
问题 I am making a pathfinding algorithm on a map with coordinates, for a project with rivers. I looked at how a* worked, and I started to understand it, so I made it in my own code. The issue is that is doesn't work at all. The pathfinder is only making the first two squares of the river, and then just giving up. I do not know the issue. Here is my code: using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Linq; public class APath { public bool

Custom made a* Path finding isn't working very well

╄→гoц情女王★ 提交于 2021-02-05 09:46:34
问题 I am making a pathfinding algorithm on a map with coordinates, for a project with rivers. I looked at how a* worked, and I started to understand it, so I made it in my own code. The issue is that is doesn't work at all. The pathfinder is only making the first two squares of the river, and then just giving up. I do not know the issue. Here is my code: using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Linq; public class APath { public bool

Optimal path through a matrix with multiple costs to consider

蓝咒 提交于 2021-02-05 07:55:09
问题 For example given the below matrix: [[[0, 8], [0, 3], [0, 8]], [[8, 0], [3, 0], [0, 5]], [[0, 1], [0, 6], [0, 0]]] where for each tuple the first number is food and the second number is water. I need to get from the bottom right to the top left and I can only move up or left. I need to gather as much food and water as possible so I can survive as long as possible. For each day I want to survive I need 1 food and 1 water so if I could choose between a path that would result in (7,4) and one

Find all paths on undirected Graph

陌路散爱 提交于 2020-06-28 04:27:16
问题 I have an undirected graph and i want to list all possible paths from a starting node. Each connection between 2 nodes is unique in a listed path is unique, for example give this graph representation: {A: [B, C, D], B: [A, C, D], C: [A, B, D], D: [A, B, C]} some listed path starting from A A, B, C, D, A, C in this path we have a connection between A and B but we can't have a connection between B and A I can't accomplish it using the existing algorithm that i know like DFS . Any help will be

How to find the shortest path between two coordinates in a 2-dimensional array?

安稳与你 提交于 2020-05-30 04:18:09
问题 I am trying to find the shortest way to get from one point in a 2D array (one coordinate with x and y values representing its position in the array) to another. I would like to output an array of coordinates which must be travelled through to get from the initial to the final coordinates. One example of an array like this could be arr = [ [15, 7, 3], [1, 2, 6], [7, 4, 67] ] In this case, we can say that we will begin at arr[0][0] and end at arr[2][2] . Thus, the coordinates would be (0, 0)