diff options
| author | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2020-06-21 23:01:57 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2020-06-21 23:01:57 +0200 |
| commit | 0e8d73bb3edcc8bdff6e3ded442b66f68265059a (patch) | |
| tree | 4f92deb9ace97e79332c0e7ce390b76b81aeaae9 /src/coordinates.h | |
| parent | 4e359b44ce111b04cc4d2b28033fba4ab4e6e989 (diff) | |
| download | nissy-0e8d73bb3edcc8bdff6e3ded442b66f68265059a.tar.gz nissy-0e8d73bb3edcc8bdff6e3ded442b66f68265059a.zip | |
First push
Diffstat (limited to '')
| -rw-r--r-- | src/coordinates.h | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/src/coordinates.h b/src/coordinates.h new file mode 100644 index 0000000..10f7d18 --- /dev/null +++ b/src/coordinates.h | |||
| @@ -0,0 +1,92 @@ | |||
| 1 | /* General rule for piece numbering (visually nicer): | ||
| 2 | * | ||
| 3 | * 0 1 2 3 4 5 6 7 8 9 10 11 | ||
| 4 | * UF UL UB UR DF DL DB DR FR FL BL BR | ||
| 5 | * UFR UFL UBL UBR DFR DFL DBL DBR | ||
| 6 | * | ||
| 7 | * The order of moves is | ||
| 8 | * 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ||
| 9 | * - U U2 U' D D2 D' R R2 R' L L2 L' F F2 F' B B2 B' | ||
| 10 | * (0 is reserved for no move) */ | ||
| 11 | |||
| 12 | #define UF 0 | ||
| 13 | #define UL 1 | ||
| 14 | #define UB 2 | ||
| 15 | #define UR 3 | ||
| 16 | #define DF 4 | ||
| 17 | #define DL 5 | ||
| 18 | #define DB 6 | ||
| 19 | #define DR 7 | ||
| 20 | #define FR 8 | ||
| 21 | #define FL 9 | ||
| 22 | #define BL 10 | ||
| 23 | #define BR 11 | ||
| 24 | |||
| 25 | #define UFR 0 | ||
| 26 | #define UFL 1 | ||
| 27 | #define UBL 2 | ||
| 28 | #define UBR 3 | ||
| 29 | #define DFR 4 | ||
| 30 | #define DFL 5 | ||
| 31 | #define DBL 6 | ||
| 32 | #define DBR 7 | ||
| 33 | |||
| 34 | #define U 1 | ||
| 35 | #define U2 2 | ||
| 36 | #define U3 3 | ||
| 37 | #define D 4 | ||
| 38 | #define D2 5 | ||
| 39 | #define D3 6 | ||
| 40 | #define R 7 | ||
| 41 | #define R2 8 | ||
| 42 | #define R3 9 | ||
| 43 | #define L 10 | ||
| 44 | #define L2 11 | ||
| 45 | #define L3 12 | ||
| 46 | #define F 13 | ||
| 47 | #define F2 14 | ||
| 48 | #define F3 15 | ||
| 49 | #define B 16 | ||
| 50 | #define B2 17 | ||
| 51 | #define B3 18 | ||
| 52 | |||
| 53 | extern char edge_string_list[12][5]; | ||
| 54 | extern char corner_string_list[8][5]; | ||
| 55 | extern char move_string_list[19][5]; | ||
| 56 | extern int inverse_move[19]; | ||
| 57 | |||
| 58 | /* Convert piece representation from integer to array. | ||
| 59 | * Come convertions are not "perfect": for example, and epud type of piece | ||
| 60 | * is represented by a permutation index in 8! elements, but it as an array | ||
| 61 | * it is converted to the first 8 elements of a 12 elements ep array (with | ||
| 62 | * meaningless values for the other 4 elements). */ | ||
| 63 | |||
| 64 | void ep_int_to_array(int ep, int a[12]); | ||
| 65 | void epud_int_to_array(int epud, int a[12]); | ||
| 66 | void epfb_int_to_array(int epfb, int a[12]); | ||
| 67 | void eprl_int_to_array(int eprl, int a[12]); | ||
| 68 | void epose_int_to_array(int epos, int a[12]); | ||
| 69 | void eposs_int_to_array(int epos, int a[12]); | ||
| 70 | void eposm_int_to_array(int epos, int a[12]); | ||
| 71 | void epe_int_to_array(int epe, int a[12]); | ||
| 72 | void epm_int_to_array(int epe, int a[12]); | ||
| 73 | void eps_int_to_array(int epe, int a[12]); | ||
| 74 | void emslices_int_to_array(int emslices, int a[12]); | ||
| 75 | void cp_int_to_array(int cp, int a[8]); | ||
| 76 | void eo_11bits_to_array(int eo, int a[12]); | ||
| 77 | void co_7trits_to_array(int co, int a[8]); | ||
| 78 | |||
| 79 | int ep_array_to_int(int ep[12]); | ||
| 80 | int epud_array_to_int(int ep[12]); | ||
| 81 | int epfb_array_to_int(int ep[12]); | ||
| 82 | int eprl_array_to_int(int ep[12]); | ||
| 83 | int epose_array_to_int(int ep[12]); | ||
| 84 | int eposs_array_to_int(int ep[12]); | ||
| 85 | int eposm_array_to_int(int ep[12]); | ||
| 86 | int epe_array_to_int(int epe[12]); | ||
| 87 | int epm_array_to_int(int epe[12]); | ||
| 88 | int eps_array_to_int(int epe[12]); | ||
| 89 | int emslices_array_to_int(int ep[12]); | ||
| 90 | int cp_array_to_int(int cp[8]); | ||
| 91 | int eo_array_to_11bits(int a[12]); | ||
| 92 | int co_array_to_7trits(int a[8]); | ||
