aboutsummaryrefslogtreecommitdiff
path: root/old/2021-02-28-transformcube-works/src/moves.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-02-28-transformcube-works/src/moves.h
parent67e1b5e6e6a2c917a2fe58a37a1382c982b1e5c5 (diff)
downloadnissy-3568412f8f230774d0d11d7ed1c897424f95d3ef.tar.gz
nissy-3568412f8f230774d0d11d7ed1c897424f95d3ef.zip
Rewritten from scratch. Welocme nissy 2.0!
Diffstat (limited to 'old/2021-02-28-transformcube-works/src/moves.h')
-rw-r--r--old/2021-02-28-transformcube-works/src/moves.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/old/2021-02-28-transformcube-works/src/moves.h b/old/2021-02-28-transformcube-works/src/moves.h
new file mode 100644
index 0000000..c1489a1
--- /dev/null
+++ b/old/2021-02-28-transformcube-works/src/moves.h
@@ -0,0 +1,50 @@
1#ifndef MOVES_H
2#define MOVES_H
3
4#include <stdio.h>
5#include <stdbool.h>
6#include <stdint.h>
7#include "cube.h"
8#include "utils.h"
9
10#define NMOVES (z3+1)
11
12typedef enum {
13 NULLMOVE,
14 U, U2, U3, D, D2, D3, R, R2, R3, L, L2, L3, F, F2, F3, B, B2, B3,
15 Uw, Uw2, Uw3, Dw, Dw2, Dw3, Rw, Rw2, Rw3,
16 Lw, Lw2, Lw3, Fw, Fw2, Fw3, Bw, Bw2, Bw3,
17 M, M2, M3, S, S2, S3, E, E2, E3,
18 x, x2, x3, y, y2, y3, z, z2, z3,
19} Move;
20
21/* An alg is an array of "NissMoves", which can be on normal or on inverse. */
22typedef struct { bool inverse; Move m; } NissMove;
23
24/* Movesets */
25extern bool standard_moveset[NMOVES];
26
27extern bool commute[NMOVES][NMOVES];
28extern bool possible_next[NMOVES][NMOVES][NMOVES];
29extern Move inverse[NMOVES];
30extern NissMove rotation_algs[24][3]; /* Same order as transformations */
31
32int len(NissMove *alg);
33int copy_alg(NissMove *src, NissMove *dest); /*return number of moves copied */
34int invert_alg(NissMove *src, NissMove *dest);
35int concat(NissMove *src1, NissMove *src2, NissMove *dest);
36void print_moves(NissMove *alg);
37int read_moves(char *str, NissMove *alg, int n); /* reads at most n moves */
38void cleanup(NissMove *src, int n); /* rewrites using basic moves, at most n */
39
40bool is_solved_up_to_reorient(Cube cube);
41Cube move_cube(Move m, Cube cube);
42Cube apply_alg(NissMove *alg, Cube cube);
43
44/* Merge the following two?
45 always in this order */
46void init_ttables(bool read, bool write);
47void init_aux_tables();
48
49
50#endif

Generated with cgit - Back to sebastiano.tronto.net