diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2022-02-27 15:36:02 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2022-02-27 15:36:02 +0100 |
| commit | 48cd8b6b1779f34ba0507cb697492de83c4e9da8 (patch) | |
| tree | c3a208fa64c3d37f328984acfb980b3f88e94060 /src/cube.c | |
| parent | de0352a2926b0708400a9629c1da813455a6f442 (diff) | |
| download | nissy-48cd8b6b1779f34ba0507cb697492de83c4e9da8.tar.gz nissy-48cd8b6b1779f34ba0507cb697492de83c4e9da8.zip | |
Moved random_cube() from cube.c to commands.c and fixed a bug in corners only and edges
only scrambles. Added fmc scrambles (with R'U'F). Updated manpage for scramble and cleanup.
Diffstat (limited to 'src/cube.c')
| -rw-r--r-- | src/cube.c | 28 |
1 files changed, 1 insertions, 27 deletions
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | static void fix_eorleoud(CubeArray *arr); | 5 | static void fix_eorleoud(CubeArray *arr); |
| 6 | static void fix_cofbcorl(CubeArray *arr); | 6 | static void fix_cofbcorl(CubeArray *arr); |
| 7 | static Cube fourval_to_cube(int eofb, int ep, int coud, int cp); | ||
| 8 | static void init_inverse(); | 7 | static void init_inverse(); |
| 9 | static bool read_invtables_file(); | 8 | static bool read_invtables_file(); |
| 10 | static bool write_invtables_file(); | 9 | static bool write_invtables_file(); |
| @@ -18,8 +17,6 @@ static uint16_t co_invtable[POW3TO7][FACTORIAL8]; | |||
| 18 | static uint16_t cp_invtable[FACTORIAL8]; | 17 | static uint16_t cp_invtable[FACTORIAL8]; |
| 19 | static uint16_t cpos_invtable[FACTORIAL6]; | 18 | static uint16_t cpos_invtable[FACTORIAL6]; |
| 20 | 19 | ||
| 21 | char *scrtypes[NSCRTYPES] = { "eo", "corners", "edges" }; | ||
| 22 | |||
| 23 | /* Functions implementation **************************************************/ | 20 | /* Functions implementation **************************************************/ |
| 24 | 21 | ||
| 25 | int | 22 | int |
| @@ -187,7 +184,7 @@ fix_cofbcorl(CubeArray *arr) | |||
| 187 | } | 184 | } |
| 188 | } | 185 | } |
| 189 | 186 | ||
| 190 | static Cube | 187 | Cube |
| 191 | fourval_to_cube(int eofb, int ep, int coud, int cp) | 188 | fourval_to_cube(int eofb, int ep, int coud, int cp) |
| 192 | { | 189 | { |
| 193 | CubeArray *arr; | 190 | CubeArray *arr; |
| @@ -544,29 +541,6 @@ print_cube(Cube cube) | |||
| 544 | printf("\n"); | 541 | printf("\n"); |
| 545 | } | 542 | } |
| 546 | 543 | ||
| 547 | Cube | ||
| 548 | random_cube(int scrt) | ||
| 549 | { | ||
| 550 | int ep, cp, eo, co; | ||
| 551 | |||
| 552 | ep = rand() % FACTORIAL12; | ||
| 553 | cp = rand() % FACTORIAL8; | ||
| 554 | eo = rand() % POW2TO11; | ||
| 555 | co = rand() % POW3TO7; | ||
| 556 | |||
| 557 | if (scrt == 0) { /* EO */ | ||
| 558 | eo = 0; | ||
| 559 | } else if (scrt == 1) { /* corners */ | ||
| 560 | eo = 0; | ||
| 561 | ep = 0; | ||
| 562 | } else if (scrt == 2) { /* edges */ | ||
| 563 | co = 0; | ||
| 564 | cp = 0; | ||
| 565 | } | ||
| 566 | |||
| 567 | return fourval_to_cube(eo, ep, co, cp); | ||
| 568 | } | ||
| 569 | |||
| 570 | Center | 544 | Center |
| 571 | what_center_at(Cube cube, Center c) | 545 | what_center_at(Cube cube, Center c) |
| 572 | { | 546 | { |
