GithubHelp home page GithubHelp logo

devoncrawford / a-pathfinding-visualization Goto Github PK

View Code? Open in Web Editor NEW
296.0 20.0 69.0 58 KB

First attempt at an efficient pathfinding algorithm in Java. I made this visualization to show the beauty of pathfinding. You can modify all major features of my algorithm through the graphics interface.

Home Page: http://devoncrawford.io/software/pathfinding

License: MIT License

Java 100.00%

a-pathfinding-visualization's Introduction

A* Pathfinding Visualization

This is my first attempt at A* pathfinding. I made this visualization to show the beauty of pathfinding. You can modify all major features of my algorithm through the graphics interface. Here I will go through the major features of my program.

Basic Controls

You must create a map to start the pathfinding. The start node is blue, end node is red and the walls are black.

To create nodes:

  • Start: hold 's' + left click
  • End: hold 'e' + left click
  • Wall: left click

To delete nodes:

  • same as creation, except right click!

basic-controls

Diagonal

My algorithm supports both diagonal and non diagonal pathfinding.

Simply check the "diagonal" box at the bottom left of the screen.

diagonal-vs-non-diagonal

Variable Speed

You may change the speed of the visualization during runtime.

  • By default, speed is 50%.

Notice: speed only works when showSteps is true.

if showSteps is false, well, that leads into the next section..

Show Steps or Timed Efficiency

You may choose to view a step-by-step process of the algorithm by selecting "showSteps" box at the bottom left.

  • If showSteps is false, the algorithm will skip visuals until the end, and process as fast as possible.

This is useful for when you want to analyze the efficiency of my algorithm in different coniditons. The example below shows "showSteps" as false, where it times the algorithm and outputs "Completed in 4ms" at the bottom left.

showsteps

Complicated Stuff

Those are the basics! Now you can be free to make the map as complicated as you desire. (Not really, because making the map too large will overflow the stack). But go ahead!

complicated-drawings

Zoom

You can (kind of) zoom in and out. I wouldn't really advise it. It does not zoom into your mouse, only towards the top left corner, and making the map too big will crash the program. This needs some work. However, If you zoom in far enough you can view each nodes information. The top left is the "F cost", bottom left is "G cost" and bottom right is "H cost". I will work on properly implementing a zoom feature soon.

a project by Devon Crawford.

a-pathfinding-visualization's People

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  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  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  avatar  avatar  avatar  avatar

Watchers

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

a-pathfinding-visualization's Issues

NO PATH FOUND

debug

Program worked fine and it showed me the path way while it was not in full screen mode but when tried it with same walls in full screen it didn't work

Simple path not found !

The software can not find the path when you put and end point on a block ( build the end point over the black wall ), apparently it sees the end point as a wall so it keeps searching.
bug

Finder hangs when changing modes

By pausing and disabling steps, the pathfinder will hang, only continuing when steps are re-enabled. (See here)
Seeing as how the time completed will be thrown off by this, I think just disabling the ability to turn off show steps while the algorithm is running might be the best option.

Easy way to build the project?

The repository contains only the source code of the app and absolutely no build information. I understand that you've probably coded this in some IDE and you've left out the project files but it would be nice to have either pom.xml or build.gradle so that everyone can compile your project easily. Would you be interested in PR regarding this?

Wrong path in case of zooming during the searching

If it is zoomed while searching the path in only searches for path in shown area.

It was zoomed in and out during the searching.
bug

It can't get out of zooming borders.
bug_in_progress

Here you can see exactly zooming area.
bug_result

I suppose this algorithm shouldn't work this way.
I hope you will fix this as soon as possible.

not an issue just a question

What does trig do? i though it might be something where you could place a trigger and the path would have to go through that then to the finish but apperantly thats not what it is. what is it?

Compiles with some warnings.

The program still 'compiles' for me, but it does output some warnings. Perhaps a PR is in order....?

javac *.java -Xlint
APathfinding.java:466: warning: [rawtypes] found raw type: ArrayList
	public void reverse(ArrayList list) {
	                    ^
  missing type arguments for generic class ArrayList<E>
  where E is a type-variable:
    E extends Object declared in class ArrayList
APathfinding.java:472: warning: [unchecked] unchecked call to add(int,E) as a member of the raw type ArrayList
			list.add(i, list.get(j - 1));
			        ^
  where E is a type-variable:
    E extends Object declared in class ArrayList
APathfinding.java:474: warning: [unchecked] unchecked call to add(int,E) as a member of the raw type ArrayList
			list.add(j, temp);
			        ^
  where E is a type-variable:
    E extends Object declared in class ArrayList
Frame.java:31: warning: [serial] serializable class Frame has no definition of serialVersionUID
public class Frame extends JPanel
       ^
ControlHandler.java:206: warning: [cast] redundant cast to int
				(int)((frame.getHeight()/2)-70), 
				^
5 warnings

No path found bug!

image

This says that there is "NO PATH FOUND" but it completely ignores the end node as if it were just another wall.

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.