Specification of a path finding algorithm
Hello, I'm working on a tower defense game. The whole game is designed on a grid : - I can place towers on the grid, troups need to find a new path each time I place one. - Troups follow a path tile by tile on the grid, from a starting tile to an end, with a minimal tile count. I recently had the idea to place multiple starting tiles, and every time I place a tower, I need to update a path for each of the starting tiles, whose path needs to be with a minimal tile count. Thing is, there are multiple possibilities for every paths to have a minimal tile count (up + down = down + up in tile count). I am satisfied with the result but I'd be happier if I could minimize the total path "tile count" (bringing some paths together at some point makes the tile count decrease). Is there any way to do this ? I do not need an algorithm which finds THE minimal solution, a solution close to a minimal one is enough. Have a nice day 👍 My current code : https://code.sololearn.com/cmSCI3d2n8CJ/?ref=app