diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-07-29 16:57:21 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-07-30 16:10:29 +0200 |
| commit | 6cf7cd87a90a1314332aace1d25b9c0f230dc227 (patch) | |
| tree | c246fbd0d400b34e6461e88a1bb50b4812eae8e5 /src/solvers/coord/gendata.h | |
| parent | ea0387796a349c91032fbcb10f50c6ad8607b0f6 (diff) | |
| download | nissy-core-6cf7cd87a90a1314332aace1d25b9c0f230dc227.tar.gz nissy-core-6cf7cd87a90a1314332aace1d25b9c0f230dc227.zip | |
added drslice coordinate
Diffstat (limited to 'src/solvers/coord/gendata.h')
| -rw-r--r-- | src/solvers/coord/gendata.h | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/src/solvers/coord/gendata.h b/src/solvers/coord/gendata.h index 678bfd7..75c57e4 100644 --- a/src/solvers/coord/gendata.h +++ b/src/solvers/coord/gendata.h | |||
| @@ -3,6 +3,8 @@ STATIC long long gendata_coord_dispatch(const char *, unsigned long long, | |||
| 3 | unsigned char *); | 3 | unsigned char *); |
| 4 | STATIC tableinfo_t genptable_coord( | 4 | STATIC tableinfo_t genptable_coord( |
| 5 | const coord_t [static 1], const unsigned char *, unsigned char *); | 5 | const coord_t [static 1], const unsigned char *, unsigned char *); |
| 6 | STATIC uint64_t genptable_coord_init_solved( | ||
| 7 | const coord_t [static 1], const unsigned char *, unsigned char *); | ||
| 6 | STATIC bool switch_to_fromnew(uint64_t, uint64_t, uint64_t); | 8 | STATIC bool switch_to_fromnew(uint64_t, uint64_t, uint64_t); |
| 7 | STATIC uint64_t genptable_coord_fillneighbors(const coord_t [static 1], | 9 | STATIC uint64_t genptable_coord_fillneighbors(const coord_t [static 1], |
| 8 | const unsigned char *, uint64_t, uint8_t, unsigned char *); | 10 | const unsigned char *, uint64_t, uint8_t, unsigned char *); |
| @@ -118,11 +120,10 @@ genptable_coord( | |||
| 118 | memset(info.distribution, 0, INFO_DISTRIBUTION_LEN * sizeof(uint64_t)); | 120 | memset(info.distribution, 0, INFO_DISTRIBUTION_LEN * sizeof(uint64_t)); |
| 119 | append_coord_name(coord, info.solver); | 121 | append_coord_name(coord, info.solver); |
| 120 | 122 | ||
| 121 | nm = popcount_u32(coord->moves_mask); | 123 | tot = info.distribution[0] = |
| 122 | i = coord->coord(SOLVED_CUBE, data); | 124 | genptable_coord_init_solved(coord, data, table); |
| 123 | set_coord_pval(coord, table, i, 0); | 125 | nm = popcount_u32(coord->moves_mask_gendata); |
| 124 | info.distribution[0] = 1; | 126 | for (d = 1; tot < coord->max && d < 15; d++) { |
| 125 | for (d = 1, tot = 1; tot < coord->max && d < 15; d++) { | ||
| 126 | t = 0; | 127 | t = 0; |
| 127 | if (switch_to_fromnew(tot, coord->max, nm)) { | 128 | if (switch_to_fromnew(tot, coord->max, nm)) { |
| 128 | for (i = 0; i < coord->max; i++) | 129 | for (i = 0; i < coord->max; i++) |
| @@ -153,6 +154,27 @@ genptable_coord( | |||
| 153 | return info; | 154 | return info; |
| 154 | } | 155 | } |
| 155 | 156 | ||
| 157 | STATIC uint64_t | ||
| 158 | genptable_coord_init_solved( | ||
| 159 | const coord_t coord[static 1], | ||
| 160 | const unsigned char *coord_data, | ||
| 161 | unsigned char *table | ||
| 162 | ) | ||
| 163 | { | ||
| 164 | uint64_t i, max_solved, ret; | ||
| 165 | |||
| 166 | max_solved = coord->is_solved == NULL ? 1 : coord->max; | ||
| 167 | |||
| 168 | for (i = 0, ret = 0; i < max_solved; i++) { | ||
| 169 | if (coord_is_solved(coord, i, coord_data)) { | ||
| 170 | set_coord_pval(coord, table, i, 0); | ||
| 171 | ret++; | ||
| 172 | } | ||
| 173 | } | ||
| 174 | |||
| 175 | return ret; | ||
| 176 | } | ||
| 177 | |||
| 156 | STATIC bool | 178 | STATIC bool |
| 157 | switch_to_fromnew(uint64_t done, uint64_t max, uint64_t nm) | 179 | switch_to_fromnew(uint64_t done, uint64_t max, uint64_t nm) |
| 158 | { | 180 | { |
| @@ -183,7 +205,8 @@ genptable_coord_fillneighbors( | |||
| 183 | c = coord->cube(i, data); | 205 | c = coord->cube(i, data); |
| 184 | tot = 0; | 206 | tot = 0; |
| 185 | for (m = 0; m < NMOVES; m++) { | 207 | for (m = 0; m < NMOVES; m++) { |
| 186 | if (!((UINT32_C(1) << (uint32_t)m) & coord->moves_mask)) | 208 | if (!((UINT32_C(1) << (uint32_t)m) & |
| 209 | coord->moves_mask_gendata)) | ||
| 187 | continue; | 210 | continue; |
| 188 | moved = move(c, m); | 211 | moved = move(c, m); |
| 189 | ii = coord->coord(moved, data); | 212 | ii = coord->coord(moved, data); |
| @@ -234,7 +257,8 @@ genptable_coord_fillfromnew( | |||
| 234 | for (j = 0, found = false; j < nsim && !found; j++) { | 257 | for (j = 0, found = false; j < nsim && !found; j++) { |
| 235 | c = coord->cube(sim[j], data); | 258 | c = coord->cube(sim[j], data); |
| 236 | for (m = 0; m < NMOVES; m++) { | 259 | for (m = 0; m < NMOVES; m++) { |
| 237 | if (!((UINT32_C(1) << (uint32_t)m) & coord->moves_mask)) | 260 | if (!((UINT32_C(1) << (uint32_t)m) & |
| 261 | coord->moves_mask_gendata)) | ||
| 238 | continue; | 262 | continue; |
| 239 | ii = coord->coord(move(c, m), data); | 263 | ii = coord->coord(move(c, m), data); |
| 240 | if (get_coord_pval(coord, table, ii) < d) { | 264 | if (get_coord_pval(coord, table, ii) < d) { |
