aboutsummaryrefslogtreecommitdiff
path: root/adhoc
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2022-06-01 20:30:16 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2022-06-01 20:30:16 +0200
commit2feaa43610b63c190762ad4b233ad648e30636d6 (patch)
tree795b481a73e55c5d742c45aca31888d79d171170 /adhoc
parent2b1b1970f774aa451f4fae197c0b1177118f3570 (diff)
downloadnissy-2feaa43610b63c190762ad4b233ad648e30636d6.tar.gz
nissy-2feaa43610b63c190762ad4b233ad648e30636d6.zip
Version 2.0.2
Diffstat (limited to 'adhoc')
-rw-r--r--adhoc/README3
-rwxr-xr-xadhoc/compile.sh15
-rw-r--r--adhoc/cornersdrhtr.c128
-rwxr-xr-xadhoc/runbin322392 -> 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 @@
1This folder contains some ad-hoc code that is not included in the main nissy
2program. You probably don't need it, but it may be worth looking into if you
3are 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
3mkdir build
4cd build
5cp -R ../../src ./
6rm src/shell.c
7cp ../$1 src/
8cp ../../Makefile ./
9make
10cp nissy ../run
11rm src/*
12rmdir src
13rm *
14cd ..
15rmdir 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 */
4bool
5allowed(Move m)
6{
7 return base_move(m) == U || m == R2 || m == F2;
8}
9
10bool
11allowed_next(Move l2, Move l1, Move m)
12{
13 return base_move(m) != base_move(l1);
14}
15
16bool
17check_cornershtr(Cube c)
18{
19 return coord_cornershtr.index(c) == 0;
20}
21
22bool
23check_coud_and_dbl(Cube c)
24{
25 return c.coud == 0 && what_corner_at(c, DBL) == DBL;
26}
27
28static int
29estimate_cornershtr_HTM(DfsArg *arg)
30{
31 return ptableval(&pd_cornershtr_HTM, arg->cube);
32}
33
34static bool
35validate_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
57int
58main()
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

Generated with cgit - Back to sebastiano.tronto.net