Code Monkey home page Code Monkey logo

astar's Introduction

astar's People

Contributors

dependabot[bot] avatar lowlighter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

astar's Issues

A* with JPS

Thanks for posting this, I'm a fan of your API! This looks much more flexible than most of the other pathfinding libs I've seen out there, and I'm actually going to switch away from the library that I've been using (bgrins/javascript-astar) and use yours instead.

Is there any chance that you would consider implementing Jump Point Search? I'm in a situation where performance is a huge concern, and I believe JPS would help alleviate some of that.

If you aren't already aware,

Demonstration (use dropdown)
Explanation 1
Explanation 2

Managing dynamic node weights

The cost() callback lets you choose how to prioritize node weight, but is there a way to actually change those node weights dynamically?

If I were to do this:

let graph = [];

for (let x = 0; x < 100; x++) {
  for (let y = 0; y < 100; y++) {
    graph[x] = graph[x] || [];
    graph[x][y] = { weight: 1 };
  }
}

let graphOptions = {
  order: "xy",
  torus: false,
  diagonals: true,
  cutting: false,
  heuristic: "euclidian",
  cost: (a, b) => {
    return b.weight;
  },
  thread: false
};

let nodeGraph = Lowlight.Astar.Configuration(graph, graphOptions);

How would I change the weight of a random node? My intuition tells me that I should be able to do something like this:

let firstNode = nodeGraph.graphs[0].node(1);
firstNode.weight = 1;

But it doesn't seem as if the weight is accessible there.

I have noticed that if I create a node directly that I can then access the weight as I would expect, however. (new Lowlight.Astar.Node(1, { x: 1, y: 0, weight: 0 }))

How would you go about solving this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.