diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-08-30 08:39:08 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-08-30 08:39:08 +0200 |
| commit | 0d958f66cf44e431bfa92a81c73a9bf3046f0aac (patch) | |
| tree | 4a4982c0085822f1ba4052d574ef8698a951da63 | |
| parent | c548499e68e473452592c9b0bf860f76bd8b94b8 (diff) | |
| download | nissy-core-0d958f66cf44e431bfa92a81c73a9bf3046f0aac.tar.gz nissy-core-0d958f66cf44e431bfa92a81c73a9bf3046f0aac.zip | |
Cleanup
| -rw-r--r-- | src/solvers/h48/gendata_cocsep.h | 2 | ||||
| -rw-r--r-- | src/solvers/h48/gendata_h48.h | 25 |
2 files changed, 13 insertions, 14 deletions
diff --git a/src/solvers/h48/gendata_cocsep.h b/src/solvers/h48/gendata_cocsep.h index 0f96da9..b7d28e1 100644 --- a/src/solvers/h48/gendata_cocsep.h +++ b/src/solvers/h48/gendata_cocsep.h | |||
| @@ -135,7 +135,7 @@ gendata_cocsep_dfs(cocsep_dfs_arg_t *arg) | |||
| 135 | return cc; | 135 | return cc; |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | memcpy(&nextarg, arg, sizeof(cocsep_dfs_arg_t)); | 138 | nextarg = *arg; |
| 139 | nextarg.depth++; | 139 | nextarg.depth++; |
| 140 | for (m = 0, cc = 0; m < 18; m++) { | 140 | for (m = 0, cc = 0; m < 18; m++) { |
| 141 | nextarg.cube = move(arg->cube, m); | 141 | nextarg.cube = move(arg->cube, m); |
diff --git a/src/solvers/h48/gendata_h48.h b/src/solvers/h48/gendata_h48.h index fbb8b35..2fd76ee 100644 --- a/src/solvers/h48/gendata_h48.h +++ b/src/solvers/h48/gendata_h48.h | |||
| @@ -333,7 +333,7 @@ gendata_h48k2(gendata_h48_arg_t *arg) | |||
| 333 | .base = base[arg->h], | 333 | .base = base[arg->h], |
| 334 | .depth = shortdepth, | 334 | .depth = shortdepth, |
| 335 | .shortdepth = shortdepth, | 335 | .shortdepth = shortdepth, |
| 336 | .maxdepth = arg->maxdepth, | 336 | .maxdepth = _min(arg->maxdepth, base[arg->h]+2), |
| 337 | .cocsepdata = arg->cocsepdata, | 337 | .cocsepdata = arg->cocsepdata, |
| 338 | .h48data = arg->h48data, | 338 | .h48data = arg->h48data, |
| 339 | .selfsim = arg->selfsim, | 339 | .selfsim = arg->selfsim, |
| @@ -358,7 +358,7 @@ int jj = 0; | |||
| 358 | gendata_h48k2_dfs(&dfsarg); | 358 | gendata_h48k2_dfs(&dfsarg); |
| 359 | ) | 359 | ) |
| 360 | #endif | 360 | #endif |
| 361 | if ((++jj) % 1000 == 0) LOG("Done %d distance 8 cubes\n", jj); | 361 | if ((++jj) % 100000 == 0) LOG("Done %d distance 8 cubes\n", jj); |
| 362 | } | 362 | } |
| 363 | 363 | ||
| 364 | h48map_destroy(&shortcubes); | 364 | h48map_destroy(&shortcubes); |
| @@ -377,30 +377,29 @@ gendata_h48k2_return_size: | |||
| 377 | _static void | 377 | _static void |
| 378 | gendata_h48k2_dfs(h48k2_dfs_arg_t *arg) | 378 | gendata_h48k2_dfs(h48k2_dfs_arg_t *arg) |
| 379 | { | 379 | { |
| 380 | bool toodeep, backtracked; | ||
| 380 | uint8_t nmoves, oldval, newval; | 381 | uint8_t nmoves, oldval, newval; |
| 381 | uint64_t val; | 382 | uint64_t mval; |
| 382 | int64_t coord, fullcoord; | 383 | int64_t coord, fullcoord; |
| 383 | h48k2_dfs_arg_t nextarg; | 384 | h48k2_dfs_arg_t nextarg; |
| 384 | uint8_t m; | 385 | uint8_t m; |
| 385 | 386 | ||
| 386 | fullcoord = coord_h48(arg->cube, arg->cocsepdata, 11); | 387 | fullcoord = coord_h48(arg->cube, arg->cocsepdata, 11); |
| 387 | coord = fullcoord >> (int64_t)(11 - arg->h); | 388 | coord = fullcoord >> (int64_t)(11 - arg->h); |
| 389 | mval = h48map_value(arg->shortcubes, fullcoord); | ||
| 388 | 390 | ||
| 389 | val = h48map_value(arg->shortcubes, fullcoord); | 391 | oldval = get_esep_pval(arg->h48data, coord, arg->k); |
| 392 | newval = arg->depth >= arg->base ? arg->depth - arg->base : 0; | ||
| 393 | set_esep_pval(arg->h48data, coord, arg->k, _min(oldval, newval)); | ||
| 390 | 394 | ||
| 391 | if (arg->depth >= arg->base && arg->depth <= arg->base + 2) { | 395 | backtracked = mval <= arg->shortdepth && arg->depth != arg->shortdepth; |
| 392 | oldval = get_esep_pval(arg->h48data, coord, arg->k); | 396 | toodeep = arg->depth >= arg->maxdepth; |
| 393 | newval = _min(oldval, arg->depth - arg->base); | 397 | if (backtracked || toodeep) |
| 394 | set_esep_pval(arg->h48data, coord, arg->k, newval); | ||
| 395 | } | ||
| 396 | |||
| 397 | if ((arg->depth > arg->shortdepth && val != MAP_UNSET_VAL) || | ||
| 398 | (arg->depth >= arg->maxdepth || arg->depth >= arg->base + 2)) | ||
| 399 | return; | 398 | return; |
| 400 | 399 | ||
| 401 | /* TODO: avoid copy, change arg and undo changes after recursion */ | 400 | /* TODO: avoid copy, change arg and undo changes after recursion */ |
| 402 | nextarg = *arg; | 401 | nextarg = *arg; |
| 403 | nextarg.depth = arg->depth + 1; | 402 | nextarg.depth++; |
| 404 | nmoves = nextarg.depth - arg->shortdepth; | 403 | nmoves = nextarg.depth - arg->shortdepth; |
| 405 | for (m = 0; m < 18; m++) { | 404 | for (m = 0; m < 18; m++) { |
| 406 | nextarg.moves[nmoves - 1] = m; | 405 | nextarg.moves[nmoves - 1] = m; |
