All Projects â†’ jrialland â†’ Python Astar

jrialland / Python Astar

Licence: bsd-3-clause
Simple implementation of the a-star algorithm in Python 🌟

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Python Astar

Baritone
google maps for block game
Stars: ✭ 3,868 (+4560.24%)
Mutual labels:  pathfinding
Lockstepengine
A lockstep solution include lots of deterministic library (Math,Collision,Navmesh,BehaviorTree,Serialization ...)
Stars: ✭ 376 (+353.01%)
Mutual labels:  pathfinding
Gdx Ai
Artificial Intelligence framework for games based on libGDX or not. Features: Steering Behaviors, Formation Motion, Pathfinding, Behavior Trees and Finite State Machines
Stars: ✭ 907 (+992.77%)
Mutual labels:  pathfinding
Unity Script Collection
A maintained collection of useful & free unity scripts / library's / plugins and extensions
Stars: ✭ 3,640 (+4285.54%)
Mutual labels:  pathfinding
Pathfinding
Pathfinding library for rust
Stars: ✭ 324 (+290.36%)
Mutual labels:  pathfinding
Jumper
Fast, lightweight and easy-to-use pathfinding library for grid-based games
Stars: ✭ 540 (+550.6%)
Mutual labels:  pathfinding
unity-pathfinding
Find paths in Unity Tilemaps with A* Search
Stars: ✭ 70 (-15.66%)
Mutual labels:  pathfinding
09 Zombierunner Original
First person shooter with Unity terrain and AI pathfinding (http://gdev.tv/cudgithub)
Stars: ✭ 64 (-22.89%)
Mutual labels:  pathfinding
Navmeshplus
Unity NavMesh 2D Pathfinding
Stars: ✭ 347 (+318.07%)
Mutual labels:  pathfinding
Goapframework
C++ General Purpose Goal Oriented Action Planning framework for Unreal Engine
Stars: ✭ 17 (-79.52%)
Mutual labels:  pathfinding
Algorithms Visualiser
Algorithms Visualiser is an opensource project made using ReactJS. Visualise Algorithms on Sorting, Pathfinding, Searching, Word Search, Backtracking.
Stars: ✭ 290 (+249.4%)
Mutual labels:  pathfinding
Roguesharp
A .NET Standard class library providing map generation, path-finding, and field-of-view utilities frequently used in roguelikes or 2D tile based games. Inspired by libtcod
Stars: ✭ 316 (+280.72%)
Mutual labels:  pathfinding
High Speed Priority Queue For C Sharp
A C# priority queue optimized for pathfinding applications
Stars: ✭ 777 (+836.14%)
Mutual labels:  pathfinding
Python Tcod
A high-performance Python port of libtcod. Includes the libtcodpy module for backwards compatibility with older projects.
Stars: ✭ 269 (+224.1%)
Mutual labels:  pathfinding
Gridpath
Gridpath is a MIT licensed multithreaded 2D implementation of A*
Stars: ✭ 31 (-62.65%)
Mutual labels:  pathfinding
CLF reactive planning system
This package provides a CLF-based reactive planning system, described in paper: Efficient Anytime CLF Reactive Planning System for a Bipedal Robot on Undulating Terrain. The reactive planning system consists of a 5-Hz planning thread to guide a robot to a distant goal and a 300-Hz Control-Lyapunov-Function-based (CLF-based) reactive thread to co…
Stars: ✭ 21 (-74.7%)
Mutual labels:  pathfinding
Libtcod
The official repository for libtcod. A roguelike development library.
Stars: ✭ 487 (+486.75%)
Mutual labels:  pathfinding
Hexgridutilitiesforgames
Hex-grid utilities for board and strategy games with path-finding, field-of-view, and more
Stars: ✭ 70 (-15.66%)
Mutual labels:  pathfinding
Jps
Jump Point Search, public domain, single .h -- OBSOLETE! See tinypile repo for a better version.
Stars: ✭ 63 (-24.1%)
Mutual labels:  pathfinding
Zeps Gui
L'interface d'un outil de calcul d'itinéraires, principalement utilisé pour se repérer dans le Netherrail de Zcraft. Nécessite https://github.com/zDevelopers/ZePS-Core .
Stars: ✭ 5 (-93.98%)
Mutual labels:  pathfinding

.. image:: https://badge.fury.io/py/astar.svg :target: https://badge.fury.io/py/astar

.. image:: https://travis-ci.com/jrialland/python-astar.svg?branch=master :target: https://travis-ci.com/jrialland/python-astar

.. image:: https://coveralls.io/repos/github/jrialland/python-astar/badge.svg?branch=master :target: https://coveralls.io/github/jrialland/python-astar?branch=master

.. image:: https://img.shields.io/github/stars/jrialland/python-astar :target: https://github.com/jrialland/python-astar

.. image:: https://img.shields.io/github/forks/jrialland/python-astar :target: https://github.com/jrialland/python-astar

python-astar

This is a simple implementation of the a-star path finding algorithm <https://en.wikipedia.org/wiki/A*_search_algorithm>__ in python

Documentation

The astar module defines the AStar class, which has to be inherited from and completed with the implementation of several methods :

neighbors


.. code:: py

    @abstractmethod
    def neighbors(self, node)

For a given node, returns (or yields) the list of its neighbors. this
method must be implemented in a subclass

This is the method that one would provide in order to give to the
algorithm the description of the graph to use during for computation

This method must be implemented in a subclass.

distance\_between

.. code:: py

@abstractmethod
def distance_between(self, n1, n2)

Gives the real distance/cost between two adjacent nodes n1 and n2 (i.e n2 belongs to the list of n1's neighbors). n2 is guaranteed to belong to the list returned by a call to neighbors(n1).

This method must be implemented in a subclass.

heuristic_cost_estimate


.. code:: py

    @abstractmethod
    def heuristic_cost_estimate(self, current, goal)

Computes the estimated (rough) distance/cost between a node and the
goal. The first argument is the start node, or any node that have been
returned by a call to the neighbors() method.

This method is used to give to the algorithm an hint about the node he
may try next during search.

This method must be implemented in a subclass.

is\_goal\_reached
~~~~~~~~~~~~~~~~~

.. code:: py


    def is_goal_reached(self, current, goal)

This method shall return a truthy value when the goal is 'reached'. By
default it checks that current == goal.

Examples
--------

Maze solver
~~~~~~~~~~~

This script generates an ascii maze, and finds the path between the upper left corner and the bottom right

``PYTHONPATH=. python tests/maze/test_maze.py``

::

    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |####    |     |              |        |              |     |
    +--+# +  +  +  +  +--+--+--+  +  +--+  +--+--+--+  +--+  +  +
    | ### |  |  |  |  |        |  |     |     |        |     |  |
    + #+--+--+  +  +  +--+  +--+  +  +--+--+  +  +--+--+  +--+  +
    | #|        |  |  |     |     |  |        |  |     |  |     |
    + #+  +--+--+  +  +  +--+  +--+  +  +--+--+  +  +  +  +  +--+
    | #|        |  |  |     |     |  |     |        |     |     |
    + #+--+--+  +  +  +--+  +--+  +  +--+--+  +--+--+--+--+--+  +
    | #      |  |  |  |        |     | ### |  |     |        |  |
    + #+--+--+  +  +  +  +--+--+--+--+ #+# +  +--+  +  +--+  +  +
    | #         |     |       ####| ####|# |  |     |     |  |  |
    + #+--+--+--+--+--+--+--+ #+ #+ #+--+# +  +  +  +--+  +  +  +
    | #|    ####|       #######| ####| ### |     |     |  |     |
    + #+--+ #+ #+--+--+ #+--+--+--+--+ #+--+  +--+--+--+  +--+--+
    | ####| #| ##########|           | ### |  | ###### |        |
    +--+ #+ #+--+--+--+--+  +--+--+  +--+# +--+ #+--+# +--+--+  +
    |  | ####|        |     |           |########|  |##| ### |  |
    +  +--+--+  +--+  +  +--+  +--+--+  +--+--+--+  + #+ #+# +  +
    |        |     |  |  |     |                    | ####|#### |
    +  +--+--+--+  +  +  +  +--+  +--+--+--+--+--+  +--+--+--+# +
    |  |           |     |     |     | ####|     |     | ###### |
    +  +  +--+--+--+--+--+  +  +--+--+##+ #+--+  +--+  + #+--+--+
    |     |  |           |  |  | ###### | ####|        | ### |  |
    +  +--+  +  +--+--+  +--+  + #+--+--+--+ #+--+--+--+--+# +  +
    |        |  |     |        | ###### |  | ############ |# |  |
    +--+--+--+  +  +  +--+--+  +--+--+# +  +--+--+--+--+# +# +  +
    |           |  |  |        | ###### | ##########|  |#### |  |
    +  +--+  +--+--+  +  +--+--+ #+--+--+ #+--+--+ #+  +--+--+  +
    |  |     |     |        | ####|     | #######| ############ |
    +  +--+--+  +  +--+  +--+ #+--+--+  +  +--+ #+--+--+--+--+# +
    |        |  |     |  | ####| ####|        | #| ### |     |##|
    +--+--+  +  +--+  +  + #+--+ #+ #+--+--+  + #+ #+# +  +  + #+
    |        |  |     |  | #######| ####|     | #| #|# |  |  | #|
    +  +--+  +  +  +--+--+--+--+--+--+ #+--+--+ #+ #+# +--+  + #+
    |  |     |  |  |                 | #| ####| ####|# |     | #|
    +  +  +--+  +  +  +--+--+--+--+  + #+ #+ #+--+--+# +  +  + #+
    |  |  |     |  |        |     |  | ####| ######### |  |  | #|
    +  +--+  +--+  +--+--+  +  +  +  +--+--+--+--+--+--+  +--+ #+
    |           |              |  |                            #|
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    
   
London Underground
~~~~~~~~~~~~~~~~~~

This script finds the shortest path between two underground stations, based on a list of London's stations

``PYTHONPATH=. python tests/london/test_london_underground.py Chesham Beckton``

::

    Chesham
    Chalfont & Latimer
    Chorleywood
    Rickmansworth
    Moor Park
    Northwood
    Northwood Hills
    Pinner
    North Harrow
    Harrow-on-the-Hill
    Northwick Park
    Preston Road
    Wembley Park
    Finchley Road
    Baker Street
    Bond Street
    Oxford Circus
    Tottenham Court Road
    Holborn
    Chancery Lane
    St. Paul's
    Bank
    Shadwell
    Limehouse
    Westferry
    Poplar
    Blackwall
    East India
    Canning Town
    Royal Victoria
    Custom House
    Prince Regent
    Royal Albert
    Beckton Park
    Cyprus
    Gallions Reach
    Beckton


TAN Network
~~~~~~~~~~~

A solution for a codingame's puzzle (https://www.codingame.com/training/hard/tan-network)

``PYTHONPATH=. python tests/tan_network/test_tan_network_5.py``

.. code:: sh

    .
    ----------------------------------------------------------------------
    Ran 1 test in 0.010s

    OK


Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].