Advertisement
tachia

Untitled

Jul 4th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.33 KB | None | 0 0
  1. /******************************************************************************
  2.  * File: Trailblazer.h
  3.  *
  4.  * Exports functions that use Dijkstra's algorithm, A* search, and Kruskal's
  5.  * algorithm as specified in the assignment handout.
  6.  */
  7.  
  8. #ifndef Trailblazer_Included
  9. #define Trailblazer_Included
  10.  
  11. #include "TrailblazerTypes.h"
  12. #include "set.h"
  13. #include "grid.h"
  14.  
  15. /* Function: shortestPath
  16.  *
  17.  * Finds the shortest path between the locations given by start and end in the
  18.  * specified world.  The cost of moving from one edge to the next is specified
  19.  * by the given cost function.  The resulting path is then returned as a
  20.  * Vector<Loc> containing the locations to visit in the order in which they
  21.  * would be visited.    If no path is found, this function should report an
  22.  * error.
  23.  *
  24.  * In Part Two of this assignment, you will need to add an additional parameter
  25.  * to this function that represents the heuristic to use while performing the
  26.  * search.  Make sure to update both this function prototype and the
  27.  * implementation inside of Trailblazer.cpp.
  28.  */
  29. Vector<Loc>
  30. shortestPath(Loc start,
  31.              Loc end,
  32.              Grid<double>& world,
  33.              double costFn(Loc from, Loc to, Grid<double>& world),double heuristic(Loc start, Loc end, Grid<double>& world));
  34.  
  35. /* Function: createMaze
  36.  *
  37.  * Creates a maze of the specified dimensions using a randomized version of
  38.  * Kruskal's algorithm, then returns a set of all of the edges in the maze.
  39.  *
  40.  * As specified in the assignment handout, the edges you should return here
  41.  * represent the connections between locations in the graph that are passable.
  42.  * Our provided starter code will then use these edges to build up a Grid
  43.  * representation of the maze.
  44.  */
  45. Set<Edge> createMaze(int numRows, int numCols);
  46.  struct Info{
  47.         string color;
  48.         Loc parent;
  49.         double way;
  50.     };
  51.     void makeList ( Map<Loc,Info> &allInf, Grid<double> & world);
  52.     Set<Loc> makeNeighbours(Loc & loc, Grid<double> & world);
  53.     Vector <Loc> findWay(Loc & start,Loc& end,Map<Loc,Info>& allInformation);
  54.     void makeChange(Loc loca,Loc loc,Map<Loc,Info> &allInformation,Grid <double> &world,double ownDistance,TrailblazerPQueue<Loc> &discuss,
  55.                 double heuristic(Loc start, Loc end, Grid<double>& world),double costFn(Loc from, Loc to, Grid<double>& world);
  56.  
  57. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement