aboutsummaryrefslogtreecommitdiff
path: root/old/2021-06-23-realizing-bad-tables/cube.h
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano.tronto@gmail.com>2021-11-11 21:37:34 +0100
committerSebastiano Tronto <sebastiano.tronto@gmail.com>2021-11-11 21:37:34 +0100
commit3568412f8f230774d0d11d7ed1c897424f95d3ef (patch)
tree77223792d8c925a9b1fc32b3f4341e943b5f8209 /old/2021-06-23-realizing-bad-tables/cube.h
parent67e1b5e6e6a2c917a2fe58a37a1382c982b1e5c5 (diff)
downloadnissy-3568412f8f230774d0d11d7ed1c897424f95d3ef.tar.gz
nissy-3568412f8f230774d0d11d7ed1c897424f95d3ef.zip
Rewritten from scratch. Welocme nissy 2.0!
Diffstat (limited to 'old/2021-06-23-realizing-bad-tables/cube.h')
-rw-r--r--old/2021-06-23-realizing-bad-tables/cube.h88
1 files changed, 88 insertions, 0 deletions
diff --git a/old/2021-06-23-realizing-bad-tables/cube.h b/old/2021-06-23-realizing-bad-tables/cube.h
new file mode 100644
index 0000000..dcad047
--- /dev/null
+++ b/old/2021-06-23-realizing-bad-tables/cube.h
@@ -0,0 +1,88 @@
1#ifndef CUBE_H
2#define CUBE_H
3
4#include <stdio.h>
5#include <stdbool.h>
6#include <stdint.h>
7#include <stdlib.h>
8#include <string.h>
9#include <time.h>
10#include <unistd.h>
11#include <sys/stat.h>
12
13/* Constants and macros *****************************************************/
14
15#define POW2TO6 64ULL
16#define POW2TO11 2048ULL
17#define POW2TO12 4096ULL
18#define POW3TO7 2187ULL
19#define POW3TO8 6561ULL
20#define FACTORIAL4 24ULL
21#define FACTORIAL6 720ULL
22#define FACTORIAL7 5040ULL
23#define FACTORIAL8 40320ULL
24#define FACTORIAL12 479001600ULL
25#define BINOM12ON4 495ULL
26#define BINOM8ON4 70ULL
27#define MIN(a,b) (((a) < (b)) ? (a) : (b))
28#define MAX(a,b) (((a) > (b)) ? (a) : (b))
29
30#define NMOVES (z3+1)
31#define NTRANS (mirror+1)
32#define NROTATIONS (NTRANS-1)
33
34/* Type definitions **********************************************************/
35
36#include "cubetypes.h"
37
38/* Public functions **********************************************************/
39
40Cube apply_alg(Alg *alg, Cube cube);
41Cube apply_move(Move m, Cube cube);
42Cube apply_trans(Trans t, Cube cube);
43bool block_solved(Cube cube, Block);
44Cube compose(Cube c2, Cube c1); /* Use c2 as an alg on c1 */
45uint64_t cphtr(Cube cube);
46uint64_t epos_dependent(Cube cube);
47bool equal(Cube c1, Cube c2);
48Cube inverse_cube(Cube cube);
49Move inverse_move(Move m);
50Trans inverse_trans(Trans t);
51bool is_admissible(Cube cube);
52bool is_solved(Cube cube, bool reorient);
53bool is_solved_center(Cube cube, Center c);
54bool is_solved_corner(Cube cube, Corner c);
55bool is_solved_edge(Cube cube, Edge e);
56void print_cube(Cube cube);
57Cube random_cube();
58AlgList * solve(Cube cube, Step step, SolveOptions *opts);
59Center what_center_at(Cube cube, Center c);
60Corner what_corner_at(Cube cube, Corner c);
61Edge what_edge_at(Cube cube, Edge e);
62int what_orientation_corner(int co, Corner c);
63int what_orientation_edge(int eo, Edge e);
64Center where_is_center(Cube cube, Center c);
65Corner where_is_corner(Cube cube, Corner c);
66Edge where_is_edge(Cube cube, Edge e);
67
68Move base_move(Move m);
69void free_alg(Alg *alg);
70void free_alglist(AlgList *l);
71Alg * inverse_alg(Alg *alg);
72Alg * new_alg(char *str);
73Alg * on_inverse(Alg *alg);
74void print_alg(Alg *alg, bool l);
75void print_alglist(AlgList *al, bool l);
76Alg * trans_alg(Trans i);
77void transform_alg(Trans t, Alg *alg);
78
79void genalgset(AlgSet *as);
80void genptable(PruneData *pd);
81void print_ptable(PruneData *pd);
82uint64_t ptablesize(PruneData *pd);
83int ptableval(PruneData *pd, uint64_t ind);
84
85void init();
86
87#endif
88

Generated with cgit - Back to sebastiano.tronto.net