Overhaul pathfinding algorithm

This commit is contained in:
2023-11-24 20:25:21 +01:00
parent 6e977b7433
commit b77e939c52
8 changed files with 127 additions and 68 deletions

View File

@@ -29,6 +29,25 @@ int main() {
printf("%d\n", node.weight);
}
printf("\n\n");
bzHeapDestroy(heap);
heap = bzHeapCreate(Node, 10);
bzHeapPush(heap, (Node) {3});
bzHeapPush(heap, (Node) {8});
bzHeapPush(heap, (Node) {10});
bzHeapPush(heap, (Node) {5});
bzHeapPush(heap, (Node) {12});
bzHeapPush(heap, (Node) {7});
heap[3].weight = 20;
bzHeapUpdate(heap, 3);
while (!bzHeapIsEmpty(heap)) {
Node node = bzHeapPop(heap);
printf("%d ", node.weight);
}
bzHeapDestroy(heap);