Darmyn
Darmyn
CC#
Created by Darmyn on 5/29/2024 in #help
Help understanding some code
I am following along with a tutorial on YouTube for AStar. There is one portion of the code that does not make sense. I will do my best to highlight the code and explain why it does not make sense. First, we take a look at the node class. From my understanding of this code (I am not fluent in CS) it seems like g and h cost are left uninitialized. https://github.com/SebLague/Pathfinding/blob/master/Episode%2003%20-%20astar/Assets/Scripts/Node.cs Knowing that gCost and hCost are never initialized, I assume that it is initialized later on. But I can not seem to find where this happens. In the main pathfinding function for AStar implementation, the code magically used the gCost value in an evaluation (Line 46). But how could it exist? Furthermore, let's consider it was magically initialized to some arbitrary number, that doesn't represent a valid gCost in the aStar algorithm. Realistically the gCost would not be known until a neighbour observed it... https://github.com/SebLague/Pathfinding/blob/master/Episode%2003%20-%20astar/Assets/Scripts/Pathfinding.cs
13 replies
CC#
Created by Darmyn on 4/9/2023 in #help
❔ List containing values that I am unsure how to represent as a type
How to accept a list of values as an argument where each value contains an actionName which is a string and an actionResult which is function?
16 replies