Code Monkey home page Code Monkey logo

astar's Introduction

astar

最近更新


商业项目放心使用,有问题会及时更新! 最近要用到寻路算法,偷懒网上搜了一批,尼玛惨不忍睹,各种bug,没办法,自己动手丰衣足食。 本版本优化了两个地方,第一个是将经典的递归改成了循环避免了堆栈溢出,第二个是优化了路径尽量走直线。

关于用法 工程项目是cocos create的,其他项目直接调用 /assets/Script/AutoFindPath.js下的getPath即可参数和返回值如下, 另外点对象的结构如下(x: 0, y: 0) /** *

  • @param {object} bron 出生点
  • @param {object} obstacles 障碍物数组
  • @param {object} target 目标
  • @param {object} map 地图
  • @param {object} girdLength 格子长度
  • @return{Array} route 路径点数组(空数组为死路)
  • */

最后我的注释写的非常详细,如果大家发现bug欢迎提issues

astar's People

Contributors

microcisco 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

Watchers

 avatar  avatar

Forkers

kevinyzy1

astar's Issues

ts版

大神 出个ts的版本吧

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.