diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-10-14 00:05:43 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-10-14 14:45:22 +0200 |
| commit | 8a91354f7b94c669c77fe628a81f9bfe9f599ef0 (patch) | |
| tree | ba29a8b0416cb3464b49fd7cfb69e7f407b892c8 /src/solvers | |
| parent | 7dbd34574f629cacf3b89292d2a06ad0ae612f26 (diff) | |
| download | nissy-core-8a91354f7b94c669c77fe628a81f9bfe9f599ef0.tar.gz nissy-core-8a91354f7b94c669c77fe628a81f9bfe9f599ef0.zip | |
Interface changes, progress with python
Diffstat (limited to 'src/solvers')
| -rw-r--r-- | src/solvers/h48/solve.h | 10 | ||||
| -rw-r--r-- | src/solvers/h48/solve_multithread.h | 10 |
2 files changed, 12 insertions, 8 deletions
diff --git a/src/solvers/h48/solve.h b/src/solvers/h48/solve.h index bcc8b33..36b6875 100644 --- a/src/solvers/h48/solve.h +++ b/src/solvers/h48/solve.h | |||
| @@ -65,12 +65,13 @@ solve_h48_appendsolution(dfsarg_solveh48_t *arg) | |||
| 65 | 65 | ||
| 66 | if (strl < 0) | 66 | if (strl < 0) |
| 67 | goto solve_h48_appendsolution_error; | 67 | goto solve_h48_appendsolution_error; |
| 68 | *arg->nextsol += strl; | 68 | *arg->nextsol += strl-1; |
| 69 | arg->solutions_size -= strl; | 69 | arg->solutions_size -= strl-1; |
| 70 | 70 | ||
| 71 | if (arg->npremoves) { | 71 | if (arg->npremoves) { |
| 72 | **arg->nextsol = ' '; | 72 | **arg->nextsol = ' '; |
| 73 | (*arg->nextsol)++; | 73 | (*arg->nextsol)++; |
| 74 | arg->solutions_size--; | ||
| 74 | 75 | ||
| 75 | invertmoves(arg->premoves, arg->npremoves, invertedpremoves); | 76 | invertmoves(arg->premoves, arg->npremoves, invertedpremoves); |
| 76 | strl = writemoves(invertedpremoves, | 77 | strl = writemoves(invertedpremoves, |
| @@ -78,13 +79,14 @@ solve_h48_appendsolution(dfsarg_solveh48_t *arg) | |||
| 78 | 79 | ||
| 79 | if (strl < 0) | 80 | if (strl < 0) |
| 80 | goto solve_h48_appendsolution_error; | 81 | goto solve_h48_appendsolution_error; |
| 81 | *arg->nextsol += strl; | 82 | *arg->nextsol += strl-1; |
| 82 | arg->solutions_size -= strl; | 83 | arg->solutions_size -= strl-1; |
| 83 | } | 84 | } |
| 84 | LOG("Solution found: %s\n", solution); | 85 | LOG("Solution found: %s\n", solution); |
| 85 | 86 | ||
| 86 | **arg->nextsol = '\n'; | 87 | **arg->nextsol = '\n'; |
| 87 | (*arg->nextsol)++; | 88 | (*arg->nextsol)++; |
| 89 | arg->solutions_size--; | ||
| 88 | (*arg->nsols)++; | 90 | (*arg->nsols)++; |
| 89 | 91 | ||
| 90 | solve_h48_appendsolution_error: | 92 | solve_h48_appendsolution_error: |
diff --git a/src/solvers/h48/solve_multithread.h b/src/solvers/h48/solve_multithread.h index 8e00404..d8c81af 100644 --- a/src/solvers/h48/solve_multithread.h +++ b/src/solvers/h48/solve_multithread.h | |||
| @@ -36,13 +36,14 @@ solve_h48_appendsolution_thread(dfsarg_solveh48_t *arg, task_queue_t *tq) | |||
| 36 | 36 | ||
| 37 | if (strl < 0) | 37 | if (strl < 0) |
| 38 | goto solve_h48_appendsolution_thread_error; | 38 | goto solve_h48_appendsolution_thread_error; |
| 39 | *arg->nextsol += strl; | 39 | *arg->nextsol += strl-1; |
| 40 | arg->solutions_size -= strl; | 40 | arg->solutions_size -= strl-1; |
| 41 | 41 | ||
| 42 | if (arg->npremoves) | 42 | if (arg->npremoves) |
| 43 | { | 43 | { |
| 44 | **arg->nextsol = ' '; | 44 | **arg->nextsol = ' '; |
| 45 | (*arg->nextsol)++; | 45 | (*arg->nextsol)++; |
| 46 | arg->solutions_size--; | ||
| 46 | 47 | ||
| 47 | invertmoves(arg->premoves, arg->npremoves, invertedpremoves); | 48 | invertmoves(arg->premoves, arg->npremoves, invertedpremoves); |
| 48 | strl = writemoves(invertedpremoves, | 49 | strl = writemoves(invertedpremoves, |
| @@ -50,13 +51,14 @@ solve_h48_appendsolution_thread(dfsarg_solveh48_t *arg, task_queue_t *tq) | |||
| 50 | 51 | ||
| 51 | if (strl < 0) | 52 | if (strl < 0) |
| 52 | goto solve_h48_appendsolution_thread_error; | 53 | goto solve_h48_appendsolution_thread_error; |
| 53 | *arg->nextsol += strl; | 54 | *arg->nextsol += strl-1; |
| 54 | arg->solutions_size -= strl; | 55 | arg->solutions_size -= strl-1; |
| 55 | } | 56 | } |
| 56 | LOG("Solution found: %s\n", solution); | 57 | LOG("Solution found: %s\n", solution); |
| 57 | 58 | ||
| 58 | **arg->nextsol = '\n'; | 59 | **arg->nextsol = '\n'; |
| 59 | (*arg->nextsol)++; | 60 | (*arg->nextsol)++; |
| 61 | arg->solutions_size--; | ||
| 60 | (*arg->nsols)++; | 62 | (*arg->nsols)++; |
| 61 | 63 | ||
| 62 | solve_h48_appendsolution_thread_error: | 64 | solve_h48_appendsolution_thread_error: |
