Pathfinding using Julia
Pathfinding functions using the Dijkstra algorithm.(which with a 'lossless' heuristic is A*)
Currently pathfind.j assumes on the nodes that:
- It has a
node_connects(node)function pointing to other nodes.
mark::Int32, each pathfind is given a number, and the number is set on nodes (that'll make multithreading harder)
- It has a
cost::Float32keeping the cost of a the current path, if it were to pass at the node.
- Either there is an
edge_costbetween nodes, or the cost is provided as argument.
That is basically all that is needed, with respect to that, pathfind.j is can 'stand alone'.
Currently it seems to me that the easiest way to include a project for
loading is to add it to
LOAD_PATH in Julia.
The test can be run by first compiling the stuff in c/ using
then symlink the julia executable into the directory;
ln -s PATH_TO_JULIA/julia julia then
sh test/pathfind.sh loads everything to test actual testing.
To test with the nodes:
run_test(1,gen_node_grid(10,10)), with grid:
Basically the second argument must
contain the world, and
rand_journey(world,mark) must return a (random)tuple
(from,to) for which it will try to pathfind from one to the other.
If there is also a
draw_all for the world and
vertex for the nodes, the
program should run with that world.
The test isnt very thurrough.
- Dijkstra algorithm pathfinding on a graph.
- Stuff that draws it and ffi for it. Done this way due to there not being a standard way to ffi this stuff yet, a bit shoddy.
- Nodes 'based on a grid', basically with `node_connects`, it returns nearby nodes.
- Nodes based by explicit lists of stuff a node connects to.
- Some stuff that is i dont really want to define myself but maybe should be 'standard' somehow. (Basically functions for 'distance' between things and 'position' of a thing, functions, not just members; sometimes a position still has to be calculated)
Basically a 'work in progress'. (Not that i'd necessarily be working on it!)
Pick inferior license.
It currently re-sorts what should have been a priority queue, maybe use this to make that proper.(it is in the examples now though)
That code also shows how pathfind.j can be 'more typed'.
Neater way to abstract what
Nodedoes? I do not want getter/setter functions, hope Julia will implement something that will have the properties i need.(Might even already exist and i missed it so far)
Figure out and describe how users can derive from
There is a 'natural-looking' image stretching method that basically involves vertical/horizontal -only pathfinding. Think for many cases that might be good to have.
'Plan of motion'; each node a grid or a convex shape of which a side is the connection to another node.
Some of it, like under c/ is public domain, the rest is under GPLv3
Jasper den Ouden