NO code needed plz draw
F is in the top left, g bottom left and H bottom right
Perform the A* algorithm to get to the goal from the starting point. Label each grid open square with the appropriate F, G, and H values (where applicable). Draw the shortest path on this grid. Starting Point Goal
- - Path Scoring The key to determining which squares to use when figuring out the path is governed by following equation F = G + H - G = the movement cost to move from the starting point A to a given square on the grid, following the path generated to get there - H = the estimated movement cost to move from that given square on the grid to the final destination, point B This is often referred to as the heuristic (guess) 1One really doesn't know the actual distance until one finds the path, because of obstacles (walls, water, etc.)
Assigning a Cost to G Assign a cost of 10 to each horizontal or vertical square moved and a cost of 14 for a diagonal move - Use these numbers because the actual distance to move diagonally is the square root of 2 (1.414) times the cost of moving horizontally or vertically The way to figure out the G cost of a square is to take the G cost of its parent, and then add 10 or 14 depending on whether it is diagonal or orthogonal (non-diagonal) from the parent square A (F = G+H) B 3
Assigning a Cost to H The method used in this example is called the Manhattan method -One calculates the total number of squares moved horizontally and vertically to reach the target square from the current square, ignoring diagonal movement, and ignoring any obstacina (F = G+H) One then multiplies the total by 10 - The cost for moving one square horizontally or vertically This is called the Manhattan Method because it is like calculating the number of city blocks from one place to another where one can't cut across the block diagonally
NO code needed plz draw F is in the top left, g bottom left and H bottom right
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
NO code needed plz draw F is in the top left, g bottom left and H bottom right
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!