diff options
| author | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2021-11-11 22:05:00 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2021-11-11 22:05:00 +0100 |
| commit | 4fb67201414169a2687f41c4056b2e284b4938cb (patch) | |
| tree | a68246e3e21435229541f83f485ab41cfb2ba08a /old/backup-manysteps-pretrans | |
| parent | 3568412f8f230774d0d11d7ed1c897424f95d3ef (diff) | |
| download | nissy-4fb67201414169a2687f41c4056b2e284b4938cb.tar.gz nissy-4fb67201414169a2687f41c4056b2e284b4938cb.zip | |
Removed old files
Diffstat (limited to 'old/backup-manysteps-pretrans')
| -rw-r--r-- | old/backup-manysteps-pretrans/steps.c | 369 | ||||
| -rw-r--r-- | old/backup-manysteps-pretrans/steps.h | 36 |
2 files changed, 0 insertions, 405 deletions
diff --git a/old/backup-manysteps-pretrans/steps.c b/old/backup-manysteps-pretrans/steps.c deleted file mode 100644 index e4d79cd..0000000 --- a/old/backup-manysteps-pretrans/steps.c +++ /dev/null | |||
| @@ -1,369 +0,0 @@ | |||
| 1 | #include "steps.h" | ||
| 2 | |||
| 3 | /* Check functions ***********************************************************/ | ||
| 4 | |||
| 5 | static int check_nothing(Cube cube); | ||
| 6 | static int check_eofb_HTM(Cube cube); | ||
| 7 | static int check_coud_HTM(Cube cube); | ||
| 8 | static int check_coud_URF(Cube cube); | ||
| 9 | static int check_corners_HTM(Cube cube); | ||
| 10 | static int check_corners_URF(Cube cube); | ||
| 11 | static int check_edges_HTM(Cube cube); | ||
| 12 | static int check_drud_HTM(Cube cube); | ||
| 13 | static int check_optimal_HTM(Cube cube); | ||
| 14 | |||
| 15 | |||
| 16 | /* Index functions ***********************************************************/ | ||
| 17 | |||
| 18 | static uint64_t index_eofb(Cube cube); | ||
| 19 | static uint64_t index_coud(Cube cube); | ||
| 20 | static uint64_t index_corners(Cube cube); | ||
| 21 | static uint64_t index_ep(Cube cube); | ||
| 22 | static uint64_t index_drud(Cube cube); | ||
| 23 | |||
| 24 | |||
| 25 | /* Steps *********************************************************************/ | ||
| 26 | |||
| 27 | Step | ||
| 28 | eofb_HTM = { | ||
| 29 | .check = check_eofb_HTM, | ||
| 30 | .ready = check_nothing, | ||
| 31 | .pre_trans = uf, | ||
| 32 | .moveset = moveset_HTM | ||
| 33 | }; | ||
| 34 | |||
| 35 | Step | ||
| 36 | eorl_HTM = { | ||
| 37 | .check = check_eofb_HTM, | ||
| 38 | .ready = check_nothing, | ||
| 39 | .pre_trans = ur, | ||
| 40 | .moveset = moveset_HTM | ||
| 41 | }; | ||
| 42 | |||
| 43 | Step | ||
| 44 | eoud_HTM = { | ||
| 45 | .check = check_eofb_HTM, | ||
| 46 | .ready = check_nothing, | ||
| 47 | .pre_trans = bu, | ||
| 48 | .moveset = moveset_HTM | ||
| 49 | }; | ||
| 50 | |||
| 51 | Step | ||
| 52 | coud_HTM = { | ||
| 53 | .check = check_coud_HTM, | ||
| 54 | .ready = check_nothing, | ||
| 55 | .pre_trans = uf, | ||
| 56 | .moveset = moveset_HTM | ||
| 57 | }; | ||
| 58 | |||
| 59 | Step | ||
| 60 | corl_HTM = { | ||
| 61 | .check = check_coud_HTM, | ||
| 62 | .ready = check_nothing, | ||
| 63 | .pre_trans = rf, | ||
| 64 | .moveset = moveset_HTM | ||
| 65 | }; | ||
| 66 | |||
| 67 | Step | ||
| 68 | cofb_HTM = { | ||
| 69 | .check = check_coud_HTM, | ||
| 70 | .ready = check_nothing, | ||
| 71 | .pre_trans = fd, | ||
| 72 | .moveset = moveset_HTM | ||
| 73 | }; | ||
| 74 | |||
| 75 | Step | ||
| 76 | coud_URF = { | ||
| 77 | .check = check_coud_URF, | ||
| 78 | .ready = check_nothing, | ||
| 79 | .pre_trans = uf, | ||
| 80 | .moveset = moveset_URF | ||
| 81 | }; | ||
| 82 | |||
| 83 | Step | ||
| 84 | corl_URF = { | ||
| 85 | .check = check_coud_URF, | ||
| 86 | .ready = check_nothing, | ||
| 87 | .pre_trans = rf, | ||
| 88 | .moveset = moveset_URF | ||
| 89 | }; | ||
| 90 | |||
| 91 | Step | ||
| 92 | cofb_URF = { | ||
| 93 | .check = check_coud_URF, | ||
| 94 | .ready = check_nothing, | ||
| 95 | .pre_trans = fd, | ||
| 96 | .moveset = moveset_URF | ||
| 97 | }; | ||
| 98 | |||
| 99 | Step | ||
| 100 | corners_HTM = { | ||
| 101 | .check = check_corners_HTM, | ||
| 102 | .ready = check_nothing, | ||
| 103 | .pre_trans = uf, | ||
| 104 | .moveset = moveset_HTM | ||
| 105 | }; | ||
| 106 | |||
| 107 | Step | ||
| 108 | corners_URF = { | ||
| 109 | .check = check_corners_URF, | ||
| 110 | .ready = check_nothing, | ||
| 111 | .pre_trans = uf, | ||
| 112 | .moveset = moveset_URF | ||
| 113 | }; | ||
| 114 | |||
| 115 | Step | ||
| 116 | edges_HTM = { | ||
| 117 | .check = check_edges_HTM, | ||
| 118 | .ready = check_nothing, | ||
| 119 | .pre_trans = uf, | ||
| 120 | .moveset = moveset_HTM | ||
| 121 | }; | ||
| 122 | |||
| 123 | Step | ||
| 124 | drud_HTM = { | ||
| 125 | .check = check_drud_HTM, | ||
| 126 | .ready = check_nothing, | ||
| 127 | .pre_trans = uf, | ||
| 128 | .moveset = moveset_HTM | ||
| 129 | }; | ||
| 130 | |||
| 131 | Step | ||
| 132 | optimal_HTM = { | ||
| 133 | .check = check_optimal_HTM, | ||
| 134 | .ready = check_nothing, | ||
| 135 | .pre_trans = uf, | ||
| 136 | .moveset = moveset_HTM | ||
| 137 | }; | ||
| 138 | |||
| 139 | |||
| 140 | /* Pruning tables ************************************************************/ | ||
| 141 | |||
| 142 | PruneData | ||
| 143 | pd_eofb_HTM = { | ||
| 144 | .filename = "ptable_eofb_HTM", | ||
| 145 | .size = POW2TO11, | ||
| 146 | .index = index_eofb, | ||
| 147 | .moveset = moveset_HTM | ||
| 148 | }; | ||
| 149 | |||
| 150 | PruneData | ||
| 151 | pd_coud_HTM = { | ||
| 152 | .filename = "ptable_coud_HTM", | ||
| 153 | .size = POW3TO7, | ||
| 154 | .index = index_coud, | ||
| 155 | .moveset = moveset_HTM | ||
| 156 | }; | ||
| 157 | |||
| 158 | PruneData | ||
| 159 | pd_corners_HTM = { | ||
| 160 | .filename = "ptable_corners_HTM", | ||
| 161 | .size = POW3TO7 * FACTORIAL8, | ||
| 162 | .index = index_corners, | ||
| 163 | .moveset = moveset_HTM | ||
| 164 | }; | ||
| 165 | |||
| 166 | PruneData | ||
| 167 | pd_ep_HTM = { | ||
| 168 | .filename = "ptable_ep_HTM", | ||
| 169 | .size = FACTORIAL12, | ||
| 170 | .index = index_ep, | ||
| 171 | .moveset = moveset_HTM | ||
| 172 | }; | ||
| 173 | |||
| 174 | PruneData | ||
| 175 | pd_drud_HTM = { | ||
| 176 | .filename = "ptable_drud_HTM", | ||
| 177 | .size = POW2TO11 * POW3TO7 * BINOM12ON4, | ||
| 178 | .index = index_drud, | ||
| 179 | .moveset = moveset_HTM | ||
| 180 | }; | ||
| 181 | |||
| 182 | |||
| 183 | /* Check functions implementation ********************************************/ | ||
| 184 | |||
| 185 | static int | ||
| 186 | check_nothing(Cube cube) | ||
| 187 | { | ||
| 188 | /* At least we check that it is admissible */ | ||
| 189 | return is_admissible(cube); | ||
| 190 | } | ||
| 191 | |||
| 192 | static int | ||
| 193 | check_eofb_HTM(Cube cube) | ||
| 194 | { | ||
| 195 | if (!pd_eofb_HTM.generated) | ||
| 196 | generate_ptable(&pd_eofb_HTM); | ||
| 197 | |||
| 198 | return PTABLEVAL(pd_eofb_HTM.ptable, cube.eofb); | ||
| 199 | } | ||
| 200 | |||
| 201 | static int | ||
| 202 | check_coud_HTM(Cube cube) | ||
| 203 | { | ||
| 204 | if (!pd_coud_HTM.generated) | ||
| 205 | generate_ptable(&pd_coud_HTM); | ||
| 206 | |||
| 207 | return PTABLEVAL(pd_coud_HTM.ptable, cube.coud); | ||
| 208 | } | ||
| 209 | |||
| 210 | static int | ||
| 211 | check_coud_URF(Cube cube) | ||
| 212 | { | ||
| 213 | /* TODO: I can improve this by checking first the orientation of | ||
| 214 | * the corner in DBL and use that as a reference */ | ||
| 215 | |||
| 216 | int ud = check_coud_HTM(cube); | ||
| 217 | int rl = check_coud_HTM(apply_move(z, cube)); | ||
| 218 | int fb = check_coud_HTM(apply_move(x, cube)); | ||
| 219 | |||
| 220 | return MIN(ud, MIN(rl, fb)); | ||
| 221 | } | ||
| 222 | |||
| 223 | static int | ||
| 224 | check_corners_HTM(Cube cube) | ||
| 225 | { | ||
| 226 | if (!pd_corners_HTM.generated) | ||
| 227 | generate_ptable(&pd_corners_HTM); | ||
| 228 | |||
| 229 | return PTABLEVAL(pd_corners_HTM.ptable, index_corners(cube)); | ||
| 230 | } | ||
| 231 | |||
| 232 | static int | ||
| 233 | check_corners_URF(Cube cube) | ||
| 234 | { | ||
| 235 | /* TODO: I can improve this by checking first the corner in DBL | ||
| 236 | * and use that as a reference */ | ||
| 237 | |||
| 238 | int ret = 15; | ||
| 239 | Trans i; | ||
| 240 | |||
| 241 | for (i = 0; i < NROTATIONS; i++) | ||
| 242 | ret = MIN(ret,check_corners_HTM(apply_alg(trans_alg(i),cube))); | ||
| 243 | |||
| 244 | return ret; | ||
| 245 | } | ||
| 246 | |||
| 247 | static int | ||
| 248 | check_edges_HTM(Cube cube) | ||
| 249 | { | ||
| 250 | int ret = 0; | ||
| 251 | |||
| 252 | if (!pd_ep_HTM.generated) | ||
| 253 | generate_ptable(&pd_ep_HTM); | ||
| 254 | |||
| 255 | ret = MAX(ret, PTABLEVAL(pd_ep_HTM.ptable, index_ep(cube))); | ||
| 256 | ret = MAX(ret, check_eofb_HTM(cube)); | ||
| 257 | ret = MAX(ret, check_eofb_HTM(apply_trans(ur, cube))); | ||
| 258 | ret = MAX(ret, check_eofb_HTM(apply_trans(fd, cube))); | ||
| 259 | |||
| 260 | return ret; | ||
| 261 | } | ||
| 262 | |||
| 263 | static int | ||
| 264 | check_drud_HTM(Cube cube) | ||
| 265 | { | ||
| 266 | if (!pd_drud_HTM.generated) | ||
| 267 | generate_ptable(&pd_drud_HTM); | ||
| 268 | |||
| 269 | return PTABLEVAL(pd_drud_HTM.ptable, index_drud(cube)); | ||
| 270 | } | ||
| 271 | |||
| 272 | static int | ||
| 273 | check_optimal_HTM(Cube cube) | ||
| 274 | { | ||
| 275 | int dr1, dr2, dr3, drmax, cor; /*ep;*/ | ||
| 276 | |||
| 277 | if (!pd_drud_HTM.generated) | ||
| 278 | generate_ptable(&pd_drud_HTM); | ||
| 279 | if (!pd_corners_HTM.generated) | ||
| 280 | generate_ptable(&pd_corners_HTM); | ||
| 281 | /* | ||
| 282 | *if (!pd_ep_HTM.generated) | ||
| 283 | * generate_ptable(&pd_ep_HTM); | ||
| 284 | */ | ||
| 285 | |||
| 286 | dr1 = PTABLEVAL(pd_drud_HTM.ptable, index_drud(cube)); | ||
| 287 | dr2 = PTABLEVAL(pd_drud_HTM.ptable, index_drud(apply_trans(rf, cube))); | ||
| 288 | dr3 = PTABLEVAL(pd_drud_HTM.ptable, index_drud(apply_trans(fd, cube))); | ||
| 289 | |||
| 290 | drmax = MAX(dr1, MAX(dr2, dr3)); | ||
| 291 | if (dr1 == dr2 && dr2 == dr3 && dr1 != 0) | ||
| 292 | drmax++; | ||
| 293 | |||
| 294 | cor = PTABLEVAL(pd_corners_HTM.ptable, index_corners(cube)); | ||
| 295 | /* ep = PTABLEVAL(pd_ep_HTM.ptable, index_ep(cube)); */ | ||
| 296 | |||
| 297 | /*return MAX(drmax, MAX(ep, cor));*/ | ||
| 298 | if (drmax == 0 && cor == 0) | ||
| 299 | return is_solved(cube, false) ? 0 : 1; | ||
| 300 | return MAX(drmax, cor); | ||
| 301 | } | ||
| 302 | |||
| 303 | |||
| 304 | /* Index functions implementation ********************************************/ | ||
| 305 | |||
| 306 | static uint64_t | ||
| 307 | index_eofb(Cube cube) | ||
| 308 | { | ||
| 309 | return cube.eofb; | ||
| 310 | } | ||
| 311 | |||
| 312 | static uint64_t | ||
| 313 | index_coud(Cube cube) | ||
| 314 | { | ||
| 315 | return cube.coud; | ||
| 316 | } | ||
| 317 | |||
| 318 | static uint64_t | ||
| 319 | index_corners(Cube cube) | ||
| 320 | { | ||
| 321 | return cube.coud * FACTORIAL8 + cube.cp; | ||
| 322 | } | ||
| 323 | |||
| 324 | static uint64_t | ||
| 325 | index_ep(Cube cube) | ||
| 326 | { | ||
| 327 | uint64_t a, b, c; | ||
| 328 | |||
| 329 | a = cube.eposs; | ||
| 330 | b = (cube.epose % FACTORIAL4) + epos_dependent_cube(cube)*FACTORIAL4; | ||
| 331 | c = cube.eposm % FACTORIAL4; | ||
| 332 | |||
| 333 | b *= FACTORIAL4 * BINOM12ON4; | ||
| 334 | c *= FACTORIAL4 * BINOM12ON4 * FACTORIAL4 * BINOM8ON4; | ||
| 335 | |||
| 336 | return a + b + c; | ||
| 337 | } | ||
| 338 | |||
| 339 | static uint64_t | ||
| 340 | index_drud(Cube cube) | ||
| 341 | { | ||
| 342 | uint64_t a, b, c; | ||
| 343 | |||
| 344 | a = cube.eofb; | ||
| 345 | b = cube.coud; | ||
| 346 | c = cube.epose / FACTORIAL4; | ||
| 347 | |||
| 348 | b *= POW2TO11; | ||
| 349 | c *= POW2TO11 * POW3TO7; | ||
| 350 | |||
| 351 | return a + b + c; | ||
| 352 | } | ||
| 353 | |||
| 354 | /* Movesets ******************************************************************/ | ||
| 355 | |||
| 356 | bool | ||
| 357 | moveset_HTM(Move m) | ||
| 358 | { | ||
| 359 | return m >= U && m <= B3; | ||
| 360 | } | ||
| 361 | |||
| 362 | bool | ||
| 363 | moveset_URF(Move m) | ||
| 364 | { | ||
| 365 | Move b = base_move(m); | ||
| 366 | |||
| 367 | return b == U || b == R || b == F; | ||
| 368 | } | ||
| 369 | |||
diff --git a/old/backup-manysteps-pretrans/steps.h b/old/backup-manysteps-pretrans/steps.h deleted file mode 100644 index b218e04..0000000 --- a/old/backup-manysteps-pretrans/steps.h +++ /dev/null | |||
| @@ -1,36 +0,0 @@ | |||
| 1 | #ifndef STEPS_H | ||
| 2 | #define STEPS_H | ||
| 3 | |||
| 4 | #include "cube.h" | ||
| 5 | |||
| 6 | /* Steps *********************************************************************/ | ||
| 7 | |||
| 8 | extern Step eofb_HTM; | ||
| 9 | extern Step eorl_HTM; | ||
| 10 | extern Step eoud_HTM; | ||
| 11 | extern Step coud_HTM; | ||
| 12 | extern Step corl_HTM; | ||
| 13 | extern Step cofb_HTM; | ||
| 14 | extern Step coud_URF; | ||
| 15 | extern Step corl_URF; | ||
| 16 | extern Step cofb_URF; | ||
| 17 | extern Step corners_HTM; | ||
| 18 | extern Step corners_URF; | ||
| 19 | extern Step edges_HTM; | ||
| 20 | extern Step drud_HTM; | ||
| 21 | extern Step optimal_HTM; | ||
| 22 | |||
| 23 | /* Pruning tables ************************************************************/ | ||
| 24 | |||
| 25 | extern PruneData pd_eofb_HTM; | ||
| 26 | extern PruneData pd_coud_HTM; | ||
| 27 | extern PruneData pd_corners_HTM; | ||
| 28 | extern PruneData pd_ep_HTM; | ||
| 29 | extern PruneData pd_drud_HTM; | ||
| 30 | |||
| 31 | /* Movesets ******************************************************************/ | ||
| 32 | |||
| 33 | bool moveset_HTM(Move m); | ||
| 34 | bool moveset_URF(Move m); | ||
| 35 | |||
| 36 | #endif | ||
