diff --git a/src/bfs.c b/src/bfs.c index 609eab0..180fdbe 100644 --- a/src/bfs.c +++ b/src/bfs.c @@ -65,10 +65,10 @@ bool run_bfs(int128_t* sum, int128_t a0, int128_t b0, int128_t c0, int print_mod print_int128(found->b); printf(", "); print_int128(found->c); printf(")\n"); - printf("Moves (%d): %s\n", max_moves, moves); + printf("Moves (%i): %s\n", max_moves, moves); } else if (print_mode == 2) { print_int128(c0); - printf(" the required amount of moves is: %d\n", max_moves); + printf(" the required amount of moves is: %i\n", max_moves); } *sum+=max_moves; diff --git a/src/node.c b/src/node.c index 7435489..535adf9 100644 --- a/src/node.c +++ b/src/node.c @@ -23,18 +23,17 @@ void node_pool_init(int32_t max_nodes) { pool = malloc(pool_capacity * sizeof(Node)); visited_pool = malloc(pool_capacity * sizeof(VisitedEntry)); if (!pool || !visited_pool) { - fprintf(stderr, "Fatal: Could not allocate Node Pool for %d nodes.\n", max_nodes); + fprintf(stderr, "Fatal: Could not allocate Node Pool for %i nodes.\n", max_nodes); exit(1); } pool_ptr = 0; visited_ptr = 0; for (size_t i = 0; i < HASH_SIZE; ++i) hash_table[i] = NULL; - queue_init(max_nodes); } Node* node_pool_alloc() { if (pool_ptr >= pool_capacity) { - fprintf(stderr, "\nNode Pool Overflow! Need more than %d nodes.\n", pool_capacity); + fprintf(stderr, "\nNode Pool Overflow! Need more than %i nodes.\n", pool_capacity); return NULL; } return &pool[pool_ptr++]; @@ -46,7 +45,6 @@ void node_pool_reset() { void node_pool_destroy() { if (pool) free(pool); - queue_destroy(); } int32_t node_pool_usage() { diff --git a/src/stergios.c b/src/stergios.c index 8ce989a..f713c55 100644 --- a/src/stergios.c +++ b/src/stergios.c @@ -49,8 +49,9 @@ void clear_global_table() { } int main() { - // Good for p = 7: 80000000 - node_pool_init(160000000); + int32_t max_nodes = 160000000; + node_pool_init(max_nodes); + queue_init(max_nodes); int mode = 0, print_mode = 0; int128_t a0 = 10, b0 = 6, c0 = 0, sum = 0; @@ -109,6 +110,7 @@ int main() { print_int128(sum); printf("\n"); } + queue_destroy(); node_pool_destroy(); return 0; } \ No newline at end of file