Last active
December 18, 2024 14:23
-
-
Save bgrins/581352 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type='text/javascript' src='astar.js'></script> | |
<script type='text/javascript'> | |
var graph = new Graph([ | |
[1,1,1,1], | |
[0,1,1,0], | |
[0,0,1,1] | |
]); | |
var start = graph.grid[0][0]; | |
var end = graph.grid[1][2]; | |
var result = astar.search(graph, start, end); | |
// result is an array containing the shortest path | |
</script> |
Check out the demo in the project page: https://github.com/bgrins/javascript-astar/tree/master/demo
How can I use with 1D array?
How can I use with 1D array?
why would you need an A* for a 1D array? To find shortest path from X to Y, just do array.join``.match(/X.*?Y/)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How can immplement this simple code into html file?