path-finding

A* search algorithm in PHP [closed]

此生再无相见时 提交于 2019-11-30 13:30:01
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . Does anyone have an implementation of the A* algorithm in PHP? I know that wikipedia has a pseudocode and a link to a C++ one, but I can't seem to find one already written in PHP. I am also looking for an efficient written A* algorithm 来源: https://stackoverflow.com/questions/5112111/a-search-algorithm-in-php

What is a good 2D grid-based path-finding algorithm? [closed]

守給你的承諾、 提交于 2019-11-30 06:45:55
I'm currently writing a 2D game in Javascript using the HTML5 <canvas> element. It's coming along very nicely, but i have run into a problem. The level design for my game is a grid (so path cost moving from one cell to the north/south/east/west cell is 1) with various obstacles occupying various locations in the grid – a lot like a maze, but with a lot more wiggle room. Each individual level is on the order of 400 × 200 cells. I'm trying to implement an enemy that will seek out the player no matter where they might be, but i'm having trouble trying to translate one of the various path-finding

What is the most efficient way of finding a path through a small world graph?

谁说我不能喝 提交于 2019-11-30 00:33:22
I have a sea of weighted nodes with edges linking clusters of nodes together. This graph follows the typical small world layout. I wish to find a path finding algorithm, which isn't costly on processor power, to find a path along the best possible path where the nodes are the most favorably weighted, the fastest route is not the most important factor. This algorithm, also takes into consideration load bearing, and traffic rerouting. (sidenote: could neural networks be used here?) Thanks I'm looking at ACO . Is there anything better than ACO for this kind of problem? Right the A* algorithm

A* Admissible Heuristic for die rolling on grid

微笑、不失礼 提交于 2019-11-29 20:36:38
I need some help finding a good heuristic for the following problem: You are given an R -by- C grid and a six-sided die. Let start and end be two distinct cells on this grid. Find a path from start to end such that the sum of the faces of the die looking up, as the die is turning along the path, is minimal. The starting orientation of the die is the following (the "2" is facing south): The way I modeled this problem is by considering the value of the die's face as the cost of an edge in a graph. The graph's vertices are of the form (row, col, die) (i.e, a position in the grid and the current

Where can I find information on the D* or D* Lite pathfinding algorithm?

ε祈祈猫儿з 提交于 2019-11-29 19:44:44
There are links to some papers on D* here , but they're a bit too mathematical for me. Is there any information on D*/D* Lite more geared towards beginners? michid Wikipedia has an article on the topic: http://en.wikipedia.org/wiki/D* Also a D* Lite implementation in C is available from Sven Koenig's page: http://idm-lab.org/code/dstarlite.tar However I find the impenetrable math much easier to read than the C source code ;-) Another implementation of D* Lite (in C++) is available here: http://code.google.com/p/dstarlite/ Well if pseudo code is hard for you (you don't have to read theorems and

Difference and advantages between dijkstra & A star [duplicate]

半世苍凉 提交于 2019-11-29 19:32:06
This question already has an answer here: How does Dijkstra's Algorithm and A-Star compare? 11 answers I read this: http://en.wikipedia.org/wiki/A*_search_algorithm It says A* is faster than using dijkstra and uses best-first-search to speed things up. If I need the algorithm to run in milliseconds, when does A* become the most prominent choice. From what I understand it does not necessarily return the best results. If I need quick results, is it better to pre-compute the paths? It may take megabytes of space to store them. amit It says A* is faster than using dijkstra and uses best-first

Java object movement

泪湿孤枕 提交于 2019-11-29 17:33:53
I am trying to get a circle to move through the input of a keyboard. I am not able to move the object at all. Can someone help me figure out what is wrong? Here is my code: import java.awt.Color; import java.awt.Graphics; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.JPanel; public class AlienInvader extends JPanel implements KeyListener{ Constants constant = new Constants(); public void update() { constant.x += constant.xvel; addKeyListener(this); } public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.MAGENTA); g.fillOval

Best First Search algorithm in Scheme

╄→尐↘猪︶ㄣ 提交于 2019-11-29 15:33:28
Okay this is a homework question, and I just don't have a clue how I suppose to start. Some help and hints will be much appreciated. I need to use a heuristic function to solve a maze type problem. Suppose I have a 5x5 grid, and a robot in position (1,5) and my goal is to move the robot to (5,1). Along the way there are few obstacles, say (X,1,3) , (X,2,3) , (X,5,3) , (X,4,2) Print out the route the robot has gone through. I'm thinking using the greedy best first search algorithm to find a path for robot to the goal My problem is, I'm new to scheme have no idea how I should start on solving

how to find all the longest paths with cypher query?

ε祈祈猫儿з 提交于 2019-11-29 10:38:51
I want to write a cypher query which finds all the longest paths among nodes which have relationship with STATUS="on" property with each other,this is what I have done so far: start n=node(*) match p = n-[r:INCLUDE*..]->m with n,MAX(length(p)) as l match p = n-[r:INCLUDE*..]->m WHERE all(rel in r where rel.status='on' AND (length(p) = l) ) return p,l It returns 3 paths with 1,2 and 3 length,not only the longest path,my query should find only the longest paths,I mean if there are 8 paths which suit to my first where condition ( where rel.status='on' ) ,with the length of 1,2,3,3,4,6,6,6 ,only

What is a good 2D grid-based path-finding algorithm? [closed]

眉间皱痕 提交于 2019-11-29 08:16:14
问题 I'm currently writing a 2D game in Javascript using the HTML5 <canvas> element. It's coming along very nicely, but i have run into a problem. The level design for my game is a grid (so path cost moving from one cell to the north/south/east/west cell is 1) with various obstacles occupying various locations in the grid – a lot like a maze, but with a lot more wiggle room. Each individual level is on the order of 400 × 200 cells. I'm trying to implement an enemy that will seek out the player no