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/moves.h | |
| parent | 4e359b44ce111b04cc4d2b28033fba4ab4e6e989 (diff) | |
| download | nissy-0e8d73bb3edcc8bdff6e3ded442b66f68265059a.tar.gz nissy-0e8d73bb3edcc8bdff6e3ded442b66f68265059a.zip | |
First push
Diffstat (limited to 'src/moves.h')
| -rw-r--r-- | src/moves.h | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/src/moves.h b/src/moves.h new file mode 100644 index 0000000..99d0ec3 --- /dev/null +++ b/src/moves.h | |||
| @@ -0,0 +1,83 @@ | |||
| 1 | #include "utils.h" | ||
| 2 | |||
| 3 | /* Bitmask that define certain movesets. */ | ||
| 4 | #define move_mask_all 524287 /* Reverse 1111111111111111111 */ | ||
| 5 | #define move_mask_eofb 155647 /* Reverse 1111111111111010010 */ | ||
| 6 | #define move_mask_eorl 518527 /* Reverse 1111111010101111111 */ | ||
| 7 | #define move_mask_eoud 524197 /* Reverse 1010010111111111111 */ | ||
| 8 | #define move_mask_drud 149887 /* Reverse 1111111010010010010 */ | ||
| 9 | #define move_mask_drfb 518437 /* Reverse 1010010010010111111 */ | ||
| 10 | #define move_mask_drrl 155557 /* Reverse 1010010111111010010 */ | ||
| 11 | #define move_mask_htr 149797 /* Reverse 1010010010010010010 */ | ||
| 12 | |||
| 13 | extern int possible_next[19][19]; | ||
| 14 | |||
| 15 | int parallel(int m1, int m2); | ||
| 16 | void init_possible_next(); | ||
| 17 | |||
| 18 | /* Transition tables */ | ||
| 19 | extern int eofb_transition_table[pow2to11][19]; | ||
| 20 | extern int eorl_transition_table[pow2to11][19]; | ||
| 21 | extern int eoud_transition_table[pow2to11][19]; | ||
| 22 | extern int coud_transition_table[pow3to7][19]; | ||
| 23 | extern int cofb_transition_table[pow3to7][19]; | ||
| 24 | extern int corl_transition_table[pow3to7][19]; | ||
| 25 | extern int epud_transition_table[factorial8][19]; | ||
| 26 | extern int epfb_transition_table[factorial8][19]; | ||
| 27 | extern int eprl_transition_table[factorial8][19]; | ||
| 28 | extern int epose_transition_table[binom12on4][19]; | ||
| 29 | extern int eposs_transition_table[binom12on4][19]; | ||
| 30 | extern int eposm_transition_table[binom12on4][19]; | ||
| 31 | extern int epe_transition_table[factorial4][19]; | ||
| 32 | extern int eps_transition_table[factorial4][19]; | ||
| 33 | extern int epm_transition_table[factorial4][19]; | ||
| 34 | extern int emslices_transition_table[binom12on4*binom8on4][19]; | ||
| 35 | extern int cp_transition_table[factorial8][19]; | ||
| 36 | |||
| 37 | |||
| 38 | /* Functions for permuting pieces (given in array format) */ | ||
| 39 | |||
| 40 | void apply_move_ep_array(int move, int ep[12]); | ||
| 41 | void apply_move_cp_array(int move, int cp[8]); | ||
| 42 | |||
| 43 | /* Functions for permuting pieces (given in integer format) */ | ||
| 44 | |||
| 45 | int apply_move_ep_int(int move, int ep); | ||
| 46 | int apply_move_epud_int(int move, int ep); | ||
| 47 | int apply_move_epfb_int(int move, int ep); | ||
| 48 | int apply_move_eprl_int(int move, int ep); | ||
| 49 | int apply_move_epose_int(int move, int ep); | ||
| 50 | int apply_move_eposs_int(int move, int ep); | ||
| 51 | int apply_move_eposm_int(int move, int ep); | ||
| 52 | int apply_move_epe_int(int move, int ep); | ||
| 53 | int apply_move_eps_int(int move, int ep); | ||
| 54 | int apply_move_epm_int(int move, int ep); | ||
| 55 | int apply_move_cp_int(int move, int cp); | ||
| 56 | int apply_move_eofb_int(int move, int eo); | ||
| 57 | int apply_move_eorl_int(int move, int eo); | ||
| 58 | int apply_move_eoud_int(int move, int eo); | ||
| 59 | int apply_move_coud_int(int move, int co); | ||
| 60 | int apply_move_cofb_int(int move, int co); | ||
| 61 | int apply_move_corl_int(int move, int co); | ||
| 62 | |||
| 63 | /* Initialize transition tables */ | ||
| 64 | |||
| 65 | void init_epud_transition_table(); | ||
| 66 | void init_epfb_transition_table(); | ||
| 67 | void init_eprl_transition_table(); | ||
| 68 | void init_epose_transition_table(); | ||
| 69 | void init_eposs_transition_table(); | ||
| 70 | void init_eposm_transition_table(); | ||
| 71 | void init_epe_transition_table(); | ||
| 72 | void init_eps_transition_table(); | ||
| 73 | void init_epm_transition_table(); | ||
| 74 | void init_cp_transition_table(); | ||
| 75 | void init_eofb_transition_table(); | ||
| 76 | void init_eorl_transition_table(); | ||
| 77 | void init_eoud_transition_table(); | ||
| 78 | void init_coud_transition_table(); | ||
| 79 | void init_cofb_transition_table(); | ||
| 80 | void init_corl_transition_table(); | ||
| 81 | |||
| 82 | void init_transition_table(); | ||
| 83 | |||
