Git Product home page Git Product logo

Comments (2)

johnhorsema avatar johnhorsema commented on May 21, 2024

You first run an algorithm to make some 2's become 0 whenever there is a bridge at top or bottom:

0
1
2

or

2
1
0

Then just run the pathfinding algorithm normally to get the path.

from easystarjs.

esromneb avatar esromneb commented on May 21, 2024

You can do this by using the setDirectionalCondition() function. You need to write code to loop over your entire grid and decide which direction tiles can be entered from. Based on your example, [1][1] can only be entered from the right and the bottom. While [3][3] can be entered from all directions. I am doing this exact thing in my code, however I have 10 levels, not just 3. I may be able to post some code if you wish.

Here's an example, the top is my grid, the bottom is my path, where step 0 is A, and step 1 is B etc. The path is only allowed a difference of 1, and no diagonals are allowed:

Screenshot from 2020-10-26 03-07-12

from easystarjs.

Related Issues (20)

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.