Complete rework of the queueing system. Adding some more helper functions in maths.c. FInally, adding valgrind (a debugger) in the nix flaes file.
Stergios Upload Compile Checker / Explore-Gitea-Actions (push) Successful in 16s
Stergios Upload Compile Checker / Explore-Gitea-Actions (push) Successful in 16s
This commit is contained in:
9 files changed
+79
-62
No files matched your search
-18
@@ -126,24 +126,6 @@ static bool bfs(int128_t* sum, int128_t a0, int128_t b0, int128_t c0, int print_
|
||||
}
|
||||
|
||||
bool solve(int128_t* sum, int128_t a0, int128_t b0, int128_t c0, int print_mode) {
|
||||
/* Try greedy first */
|
||||
int32_t g = -1;//greedy(a0, b0, c0);
|
||||
if (g >= 0) {
|
||||
*sum += g;
|
||||
if (print_mode == 1) {
|
||||
printf("\nSolution found!\n");
|
||||
printf("Initial: (");
|
||||
print_int128(a0); printf(", ");
|
||||
print_int128(b0); printf(", ");
|
||||
print_int128(c0); printf(")\n");
|
||||
printf("Moves (%i): [greedy]\n", g);
|
||||
} else if (print_mode == 2) {
|
||||
print_int128(c0);
|
||||
printf(" the required amount of moves is: %i\n", g);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Fallback to BFS */
|
||||
return bfs(sum, a0, b0, c0, print_mode);
|
||||
}
|
||||
Reference in new issue
Block a user