Class AStar


  • @Component
    @Lazy
    @DependentInitialisation(ch.sahits.game.openpatrician.model.initialisation.StartNewGameBean.class)
    public class AStar
    extends java.lang.Object
    Implementation of the A* pathfinding algorithm. Implementation is based on this code review: http://codereview.stackexchange.com/questions/38376/a-search-algorithm
    Author:
    Andi Hotz, (c) Sahits GmbH, 2016 Created on Jan 01, 2016
    • Constructor Summary

      Constructors 
      Constructor Description
      AStar()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<javafx.geometry.Point2D> findPath​(javafx.geometry.Point2D source, javafx.geometry.Point2D destination)
      Implements the A-star algorithm and returns the path from source to destination
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AStar

        public AStar()
    • Method Detail

      • findPath

        public java.util.List<javafx.geometry.Point2D> findPath​(javafx.geometry.Point2D source,
                                                                javafx.geometry.Point2D destination)
        Implements the A-star algorithm and returns the path from source to destination
        Parameters:
        source - the source nodeid
        destination - the destination nodeid
        Returns:
        the path from source to destination