diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2022-06-01 20:30:16 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2022-06-01 20:30:16 +0200 |
| commit | 2feaa43610b63c190762ad4b233ad648e30636d6 (patch) | |
| tree | 795b481a73e55c5d742c45aca31888d79d171170 /adhoc | |
| parent | 2b1b1970f774aa451f4fae197c0b1177118f3570 (diff) | |
| download | nissy-2feaa43610b63c190762ad4b233ad648e30636d6.tar.gz nissy-2feaa43610b63c190762ad4b233ad648e30636d6.zip | |
Version 2.0.2
Diffstat (limited to '')
| -rw-r--r-- | adhoc/README | 3 | ||||
| -rwxr-xr-x | adhoc/compile.sh | 15 | ||||
| -rw-r--r-- | adhoc/cornersdrhtr.c | 128 | ||||
| -rwxr-xr-x | adhoc/run | bin | 322392 -> 0 bytes |
4 files changed, 0 insertions, 146 deletions
diff --git a/adhoc/README b/adhoc/README deleted file mode 100644 index 8f72c6e..0000000 --- a/adhoc/README +++ /dev/null | |||
| @@ -1,3 +0,0 @@ | |||
| 1 | This folder contains some ad-hoc code that is not included in the main nissy | ||
| 2 | program. You probably don't need it, but it may be worth looking into if you | ||
| 3 | are trying to extend nissy by writing your own steps or other functions. | ||
diff --git a/adhoc/compile.sh b/adhoc/compile.sh deleted file mode 100755 index aa541c7..0000000 --- a/adhoc/compile.sh +++ /dev/null | |||
| @@ -1,15 +0,0 @@ | |||
| 1 | #/!bin/sh | ||
| 2 | |||
| 3 | mkdir build | ||
| 4 | cd build | ||
| 5 | cp -R ../../src ./ | ||
| 6 | rm src/shell.c | ||
| 7 | cp ../$1 src/ | ||
| 8 | cp ../../Makefile ./ | ||
| 9 | make | ||
| 10 | cp nissy ../run | ||
| 11 | rm src/* | ||
| 12 | rmdir src | ||
| 13 | rm * | ||
| 14 | cd .. | ||
| 15 | rmdir build | ||
diff --git a/adhoc/cornersdrhtr.c b/adhoc/cornersdrhtr.c deleted file mode 100644 index 2a5a6e6..0000000 --- a/adhoc/cornersdrhtr.c +++ /dev/null | |||
| @@ -1,128 +0,0 @@ | |||
| 1 | #include "commands.h" | ||
| 2 | |||
| 3 | /* Some of the following functions are new, some are copied from steps.c */ | ||
| 4 | bool | ||
| 5 | allowed(Move m) | ||
| 6 | { | ||
| 7 | return base_move(m) == U || m == R2 || m == F2; | ||
| 8 | } | ||
| 9 | |||
| 10 | bool | ||
| 11 | allowed_next(Move l2, Move l1, Move m) | ||
| 12 | { | ||
| 13 | return base_move(m) != base_move(l1); | ||
| 14 | } | ||
| 15 | |||
| 16 | bool | ||
| 17 | check_cornershtr(Cube c) | ||
| 18 | { | ||
| 19 | return coord_cornershtr.index(c) == 0; | ||
| 20 | } | ||
| 21 | |||
| 22 | bool | ||
| 23 | check_coud_and_dbl(Cube c) | ||
| 24 | { | ||
| 25 | return c.coud == 0 && what_corner_at(c, DBL) == DBL; | ||
| 26 | } | ||
| 27 | |||
| 28 | static int | ||
| 29 | estimate_cornershtr_HTM(DfsArg *arg) | ||
| 30 | { | ||
| 31 | return ptableval(&pd_cornershtr_HTM, arg->cube); | ||
| 32 | } | ||
| 33 | |||
| 34 | static bool | ||
| 35 | validate_singlecw_ending(Alg *alg) | ||
| 36 | { | ||
| 37 | int i; | ||
| 38 | bool nor, inv; | ||
| 39 | Move l2 = NULLMOVE, l1 = NULLMOVE, l2i = NULLMOVE, l1i = NULLMOVE; | ||
| 40 | |||
| 41 | for (i = 0; i < alg->len; i++) { | ||
| 42 | if (alg->inv[i]) { | ||
| 43 | l2i = l1i; | ||
| 44 | l1i = alg->move[i]; | ||
| 45 | } else { | ||
| 46 | l2 = l1; | ||
| 47 | l1 = alg->move[i]; | ||
| 48 | } | ||
| 49 | } | ||
| 50 | |||
| 51 | nor = l1 ==base_move(l1) && (!commute(l1, l2) ||l2 ==base_move(l2)); | ||
| 52 | inv = l1i==base_move(l1i) && (!commute(l1i,l2i)||l2i==base_move(l2i)); | ||
| 53 | |||
| 54 | return nor && inv; | ||
| 55 | } | ||
| 56 | |||
| 57 | int | ||
| 58 | main() | ||
| 59 | { | ||
| 60 | Moveset moveset_UR2F2 = { | ||
| 61 | .allowed = allowed, | ||
| 62 | .allowed_next = allowed_next, | ||
| 63 | }; | ||
| 64 | |||
| 65 | init_moveset(&moveset_UR2F2); | ||
| 66 | |||
| 67 | /* | ||
| 68 | * This step is the same as cornershtr_HTM in steps.c, except for | ||
| 69 | * the ready() function (which is not relevant anyway, it is there | ||
| 70 | * more for testing than anything else) and the moveset. | ||
| 71 | */ | ||
| 72 | Step step = { | ||
| 73 | .final = false, | ||
| 74 | .is_done = check_cornershtr, | ||
| 75 | .estimate = estimate_cornershtr_HTM, | ||
| 76 | .ready = check_coud_and_dbl, | ||
| 77 | .is_valid = validate_singlecw_ending, | ||
| 78 | .moveset = &moveset_UR2F2, | ||
| 79 | |||
| 80 | .pre_trans = uf, | ||
| 81 | |||
| 82 | .tables = {&pd_cornershtr_HTM}, | ||
| 83 | .ntables = 1, | ||
| 84 | }; | ||
| 85 | |||
| 86 | SolveOptions opts = { | ||
| 87 | .min_moves = 0, | ||
| 88 | .max_moves = 20, | ||
| 89 | .max_solutions = 1, | ||
| 90 | .nthreads = 4, | ||
| 91 | .optimal = 0, | ||
| 92 | .can_niss = false, | ||
| 93 | .verbose = false, | ||
| 94 | .all = false, | ||
| 95 | .print_number = false, | ||
| 96 | .count_only = false | ||
| 97 | }; | ||
| 98 | |||
| 99 | init_symcoord(); | ||
| 100 | |||
| 101 | bool cphtr_state_done[BINOM8ON4*6]; | ||
| 102 | for (unsigned long int i = 0; i < BINOM8ON4*6; i++) | ||
| 103 | cphtr_state_done[i] = false; | ||
| 104 | |||
| 105 | for (unsigned long int i = 0; i < FACTORIAL8; i++) { | ||
| 106 | AlgList *sols; | ||
| 107 | Cube c = {0}; | ||
| 108 | c.cp = i; /* inconsistent state because of side CO */ | ||
| 109 | |||
| 110 | if (what_corner_at(c, DBL) != DBL || | ||
| 111 | cphtr_state_done[coord_cphtr.index(c)]) | ||
| 112 | continue; | ||
| 113 | |||
| 114 | fprintf(stderr, "Doing cp %ld (cphtr state %ld)\n", | ||
| 115 | i, coord_cphtr.index(c)); | ||
| 116 | |||
| 117 | cphtr_state_done[coord_cphtr.index(c)] = true; | ||
| 118 | /* Comment next two lines to get non-reduced list */ | ||
| 119 | Cube mirror = apply_trans(ur_mirror, c); | ||
| 120 | cphtr_state_done[coord_cphtr.index(mirror)] = true; | ||
| 121 | |||
| 122 | sols = solve(c, &step, &opts); | ||
| 123 | printf("%.2d\t", sols->first->alg->len); | ||
| 124 | print_alglist(sols, opts.print_number); | ||
| 125 | } | ||
| 126 | |||
| 127 | return 0; | ||
| 128 | } | ||
diff --git a/adhoc/run b/adhoc/run deleted file mode 100755 index 27541c2..0000000 --- a/adhoc/run +++ /dev/null | |||
| Binary files differ | |||
