diff options
| author | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2021-12-11 11:44:44 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2021-12-11 11:44:44 +0100 |
| commit | 9725570d740041b51d6bdfbc8416498ddad77666 (patch) | |
| tree | 8f398d56c1562c76bad5d17cb35878bcc7df4084 | |
| parent | b9312ca130f5ebca35ea657a332e168841a0d5c8 (diff) | |
| download | nissy-9725570d740041b51d6bdfbc8416498ddad77666.tar.gz nissy-9725570d740041b51d6bdfbc8416498ddad77666.zip | |
Improved where_is_edge
Diffstat (limited to '')
| -rw-r--r-- | TODO.md | 1 | ||||
| -rwxr-xr-x | nissy | bin | 169544 -> 173944 bytes | |||
| -rw-r--r-- | src/cube.c | 32 |
3 files changed, 14 insertions, 19 deletions
| @@ -23,6 +23,7 @@ It's more of a personal reminder than anything else. | |||
| 23 | 23 | ||
| 24 | ### Improvements to currently implemented commands | 24 | ### Improvements to currently implemented commands |
| 25 | * batch mode: add separator / info on which command it is executing | 25 | * batch mode: add separator / info on which command it is executing |
| 26 | (also change man page for this) | ||
| 26 | * solve should re-orient first if needed and not just give up if centers are off | 27 | * solve should re-orient first if needed and not just give up if centers are off |
| 27 | * solve should try up to a small bound without loading the large pruning table | 28 | * solve should try up to a small bound without loading the large pruning table |
| 28 | * drfin for HTR scrambles should try all 3 axis and pick the best solutions; | 29 | * drfin for HTR scrambles should try all 3 axis and pick the best solutions; |
| Binary files differ | |||
| @@ -641,23 +641,22 @@ where_is_corner(Cube cube, Corner c) | |||
| 641 | } | 641 | } |
| 642 | 642 | ||
| 643 | Edge | 643 | Edge |
| 644 | where_is_edge(Cube cube, Edge e) | 644 | where_is_edge(Cube c, Edge e) |
| 645 | { | 645 | { |
| 646 | /* TODO: when I wrote this code I forgot to add the final | 646 | int r0, r1, r2; |
| 647 | part, and now I can't remember how it was supposed to | ||
| 648 | work (i.e. how to recover the location of the edge | ||
| 649 | from these tables. I think it is either very easy or | ||
| 650 | wrong, in any case it is not a priority now. | ||
| 651 | Future Seba can deal with it. | ||
| 652 | 647 | ||
| 653 | static bool initialized = false; | 648 | static bool initialized = false; |
| 654 | static Edge aux[3][FACTORIAL12/FACTORIAL8][12]; | 649 | static int aux[3][BINOM12ON4*FACTORIAL4][12]; |
| 655 | static int i; | 650 | static int i, j; |
| 656 | static unsigned int ui; | 651 | static unsigned int ui; |
| 657 | static CubeArray *arr; | 652 | static CubeArray *arr; |
| 658 | 653 | ||
| 659 | if (!initialized) { | 654 | if (!initialized) { |
| 660 | for (ui = 0; ui < FACTORIAL12/FACTORIAL8; ui++) { | 655 | for (ui = 0; ui < BINOM12ON4*FACTORIAL4; ui++) { |
| 656 | for (i = 0; i < 3; i++) | ||
| 657 | for (j = 0; j < 12; j++) | ||
| 658 | aux[i][ui][j] = -1; | ||
| 659 | |||
| 661 | arr = new_cubearray((Cube){.epose = ui}, pf_e); | 660 | arr = new_cubearray((Cube){.epose = ui}, pf_e); |
| 662 | for (i = 0; i < 12; i++) | 661 | for (i = 0; i < 12; i++) |
| 663 | if (edge_slice(arr->ep[i]) == 0) | 662 | if (edge_slice(arr->ep[i]) == 0) |
| @@ -679,14 +678,9 @@ where_is_edge(Cube cube, Edge e) | |||
| 679 | 678 | ||
| 680 | initialized = true; | 679 | initialized = true; |
| 681 | } | 680 | } |
| 682 | */ | ||
| 683 | |||
| 684 | int i; | ||
| 685 | CubeArray *arr = new_cubearray(cube, pf_ep); | ||
| 686 | 681 | ||
| 687 | for (i = 0; i < 12; i++) | 682 | r0 = aux[0][c.epose][e]; |
| 688 | if ((Edge)arr->ep[i] == e) | 683 | r1 = aux[1][c.eposs][e]; |
| 689 | return i; | 684 | r2 = aux[2][c.eposm][e]; |
| 690 | 685 | return MAX(r0, MAX(r1, r2)); | |
| 691 | return -1; | ||
| 692 | } | 686 | } |
