Hello,
I have an assignment for school and I cant seem to find a solution.
I added my code and everything needed for the assignment.
Thanks so much for your help.
#Longest Path Assignment
1 messages · Page 1 of 1 (latest)
hey so i did some things to the code but i cant seem to find the answers
this is my latest version but i tried everything and cant help myself anymore
thanks for any help
well, there is many way to address this problem, including using AI and tree navigation, but the easiest answer is to simply try ALL paths 😬
Optimization 1: include length of "close loop path" to avoid duplication of calculations
Optimization 2: remove any closed paths that won't resolve
Optimization 3: Use ML to find all possibile exit paths efficiently, then choose longest answer.
Optimization 4: Use ML to find the shortest path, then write this algorithm in reverse 🤣
#5. your teacher is crazy.
Funny thing is im not even studying cs, so yeah he is crazy :D, could you please elaborate on these things in simpler terms so i get a better understanding of how to continue
i improved it a little thanks to chatgpt and it seems to work but i cant find why it doesnt terminate
You have to "remember" all the paths you took, so I would use recursion for this, when there is more than one choices,
which means you need an Integer[] or VO for memory 🧠
This is really path traversal
Both of these solutions forgot to mark visited cells and also forgot to add to "memory"
But A* or D* algorithms work pretty well. They use a graph, which you should be able to define from your world definition. (http://en.wikipedia.org/wiki/A*)
Also Dijstra's algorithm should work at finding a path (again uses a graph). It is commonly used for network routing - but it also works for normal path finding. (http://en.wikipedia.org/wiki/Dijkstra's_algorithm)
A* or A star may refer to:
A* search algorithm, a pathfinding algorithm used in computing
A*, the highest grade in examination systems such as the GCE Advanced Level
ASTAR, the Singapore Agency for Science, Technology and Research
AStar, the Eurocopter AS350 Écureuil helicopter
Class A star, a star of spectral class A
Sagittarius A, a radio s...
Dijkstra's algorithm ( DYKE-strəz) is an algorithm for finding the shortest paths between nodes in a weighted graph, which may represent, for example, road networks. It was conceived by computer scientist Edsger W. Dijkstra in 1956 and published three years later.The algorithm exists in many variants. Dijkstra's original algorithm found the sho...
A* (pronounced "A-star") is a graph traversal and path search algorithm, which is used in many fields of computer science due to its completeness, optimality, and optimal efficiency. Given a weighted graph, a source node and a goal node, the algorithm finds the shortest path (with respect to the given weights) from source to goal.
One major prac...
D* (pronounced "D star") is any one of the following three related incremental search algorithms:
The original D*, by Anthony Stentz, is an informed incremental search algorithm.
Focused D* is an informed incremental heuristic search algorithm by Anthony Stentz that combines ideas of A* and the original D*. Focused D* resulted from a further de...
LPA* or Lifelong Planning A* is an incremental heuristic search algorithm based on A*. It was first described by Sven Koenig and Maxim Likhachev in 2001.
This is similar to the Tesla parking lot navigation / parking strategy, except in their case they try to find the shortest path that does not fail