Coder Social home page Coder Social logo

vivaladav / pyfinder Goto Github PK

View Code? Open in Web Editor NEW
17.0 3.0 0.0 160 KB

An A* (A-star) pathfinder in Python in 3 versions: CLI, pygame and Qt

License: MIT License

Python 100.00%
python3 python pathfinding pathfinder astar astar-algorithm astar-pathfinding ai qt qt5 pyqt5 pyqt benchmark pygame

pyfinder's Introduction

pyfinder

An A* (A-star) pathfinder in Python.

I am creating this to learn more about Python and the plan is to create 3 applications using different libraries to handle things in different ways.

I also added a simple benchmark to test how quick the pathfinder can be.

Because I am doing this for learning, I published this repository after the first commit, when nothing was finished yet. The idea is to share the whole progress with others and eventually to get feedback along the way.

Currently all the applications are feature complete and seem to work fine. Feel free to create an issue if you spot any bug or if you want to request a new feature.

Applications

pyfinder.py

This is the first version of the pathfinder. It's a CLI (Command Line Interface) application that loads a map from a file passed as argument, then prompts the user for a start and a goal cell and finally shows the path.

Current status: Done

Example of usage

$ python3 pyfinder.py data/maps/map_01.map

example of usage of pyfinder.py

pg-pyfinder.py

A visual application based on pygame.

Current status: Done

Example of usage

$ python3 pg-pyfinder.py data/maps/map_01.map 60

Second parameter is optional and it defines the size of a cell of the map in pixels (default is 30).

To search for a path simply click on the map twice.

example of usage of pg-pyfinder.py

After a path is visualized click one more time to clear it.

In the following image you can see what happens when no path can be found:

example of pg-pyfinder when no path can be found

qt-pyfinder.py

A visual application based on Qt for Python.

Current status: Done

Example of usage

$ python3 qt-pyfinder.py

After starting the application load a map from the menu File > Open Map:

qt-pyfinder.py file menu

It's possible to configure several options from the menu File > Options:

qt-pyfinder.py options dialog

pyfinder-bench.py

A simple benchmark to verify how quick pathfinding is, on average.

Current status: Done

Example of usage

$ python3 pyfinder-bench.py data/maps/map_01.map

example of usage of pyfinder-bench.py

Map format

Currently a map is a text file which contains 2 possible symbols:

  • ' ' = walkable cell
  • '#' = unwalkable cell

Map cells start from (0, 0) which represents the first characer of the map file.

Examples of map files can be found in data/maps/

pyfinder's People

Contributors

vivaladav avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

pyfinder's Issues

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.