Code Monkey home page Code Monkey logo

file-pathfinding's Introduction

dijkstra pathfinder for files

This is a basic implementation of the dijkstra pathfinding algorithm that lets you create a file with components such as a start, an end and multiple ways. It will output a file similar to the input file only containing one of the shortest ways from start to end. Additionally in the console output you can find the coordinates (line and column) of the generated path. With this code it is also possible to run this algorithm in a char matrix. The open-source graph library by QUALiS-NRW can be found in the graph folder has been used and modified to represent the file internally as a graph. The authors and the documentation can be found directly in the graph files. https://www.schulentwicklung.nrw.de/lehrplaene/upload/klp_SII/if/MaterialZABI/2020-03-11_Implementationen_von_Klassen_fuer_das_Zentralabitur_ab_2018.zip

No HashMaps or PriorityQueues were used for this implementation to make it beginner-friendly and more accessible to early learners.

Usage

By default this character preset is used with all unsed characters treatet as empty:

  • start of path: -
  • end of path: +
  • a way: x
  • unsuable empty space:

This preset can easily be modified in the enum located in the position.java file

public enum Position{
    start('-'), way('x'), end('+'), empty(' ');

    private final char letter;

    private Position(char letter) {
        this.letter = letter;
    }

    public char getLetter(){
        return letter;
    }
}

Example of an input file:

-xxxxxxxxxxxxxxxxxxxxxxx
            xx         x
    xxxxxx  x          x
    xxxxx+  x          x
    x       x          x
    x       x          x
    x       x          x
    xxxxxxxxxxxxxxxxxxxx

Generated output file:

-xxxxxxxxxxxx
            x
            x
    xxxxx+  x
    x       x
    x       x
    x       x
    xxxxxxxxx

As you can see paths are not connected diagonally since the graph that is generated by the file only creates edges for characters that are directly next to each ohter. Multiple templates can be found named fileTest.txt.

file-pathfinding's People

Contributors

derpzz avatar

Watchers

James Cloos avatar  avatar

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.