Browse Source

update: short code offset header

legacy
Dnomd343 2 years ago
parent
commit
35b501be6b
  1. 12
      src/klotski_core/short_code/offset/all_cases_offset.h
  2. 12
      src/klotski_core/short_code/offset/basic_ranges_offset.h
  3. 75
      src/klotski_core/short_code/offset/range_prefix_offset.h

12
src/klotski_core/short_code/offset/all_cases_offset.h

@ -1,12 +1,18 @@
#pragma once
/// This is the head index, the offset (0 ~ 29334498) in all cases is obtained
/// according to the `head` (0 ~ 15). In other words, the short code range can be
/// obtained according to the position of the 2x2 block.
#include <cstdint>
namespace klotski {
const uint32_t ALL_CASES_OFFSET[16] = {
const uint32_t ALL_CASES_OFFSET[16] = {
0, 2942906, 5203298, 8146204,
8146204, 10468254, 12345199, 14667249,
14667249, 16989299, 18866244, 21188294,
21188294, 24131200, 26391592, 29334498,
};
}
};
} // namespace klotski

12
src/klotski_core/short_code/offset/basic_ranges_offset.h

@ -1,9 +1,14 @@
#pragma once
/// This is the index for basic ranges, and its position (0 ~ 7311920) in all
/// basic ranges is located according to the first 12-bit (0 ~ 4095) of the
/// 32-bit `range`.
#include <cstdint>
namespace klotski {
const uint32_t BASIC_RANGES_OFFSET[4096] = {
const uint32_t BASIC_RANGES_OFFSET[4096] = {
0, 18272, 24960, 31648, 49920, 56608, 59056, 61504,
68192, 74880, 77328, 79776, 86464, 104736, 111424, 118112,
136384, 143072, 145520, 147968, 154656, 157104, 158000, 158896,
@ -516,5 +521,6 @@ namespace klotski {
7169387, 7171664, 7172256, 7172848, 7174633, 7180980, 7182765, 7184550,
7189796, 7208068, 7214415, 7220762, 7238351, 7244698, 7246483, 7248268,
7253514, 7259861, 7261646, 7263431, 7268677, 7286266, 7291512, 7296758,
};
}
};
} // namespace klotski

75
src/klotski_core/short_code/offset/range_prefix_offset.h

@ -1,10 +1,16 @@
#pragma once
/// This is the index for the range prefix. Given the `head` and the first
/// 12-bit (0 ~ 4095) of the `range`, you can get the positions of all cases
/// in the current `head`. That is, according to the position of 2x2 block
/// and the `range`, the short code range is obtained.
#include <cstdint>
namespace klotski {
const uint32_t RANGE_PREFIX_OFFSET[16][4096] = {{
/// --------------------------------------------------------------------- 0x0 ---------------------------------------------------------------------
const uint32_t RANGE_PREFIX_OFFSET[16][4096] = {{
/// --------------------------------------------------------------------- 0x0 ---------------------------------------------------------------------
0, 9527, 12991, 16067, 25594, 29058, 30527, 31657, 35121, 38525, 39766, 41041, 44445, 53972, 57436, 60512,
70039, 70039, 70039, 70039, 70039, 70039, 70039, 70039, 70039, 70039, 70039, 70039, 70039, 70039, 70039, 70039,
70039, 73445, 74914, 76019, 79425, 80894, 80894, 81362, 82831, 84047, 84573, 85031, 86247, 89653, 91122, 92227,
@ -261,8 +267,8 @@ namespace klotski {
2854438, 2854438, 2854438, 2854438, 2854438, 2854438, 2854438, 2854438, 2854438, 2854438, 2854438, 2854438, 2854438, 2854438, 2854438, 2854438,
2854438, 2857844, 2859242, 2860307, 2863615, 2865013, 2865013, 2865367, 2866529, 2867702, 2868094, 2868444, 2869447, 2872755, 2873917, 2874830,
2877744, 2887271, 2890632, 2893622, 2902931, 2906292, 2907454, 2908380, 2911332, 2914639, 2915655, 2916686, 2919600, 2928909, 2931861, 2934505,
}, {
/// --------------------------------------------------------------------- 0x1 ---------------------------------------------------------------------
}, {
/// --------------------------------------------------------------------- 0x1 ---------------------------------------------------------------------
0, 9527, 12991, 16067, 25594, 29058, 30527, 31657, 35121, 38525, 39766, 41041, 44445, 53972, 57436, 60512,
70039, 70039, 70039, 70039, 70039, 70039, 70039, 70039, 70039, 70039, 70039, 70039, 70039, 70039, 70039, 70039,
70039, 73445, 74914, 76019, 79425, 80894, 80894, 81362, 82831, 84047, 84573, 85031, 86247, 89653, 91122, 92227,
@ -519,8 +525,8 @@ namespace klotski {
2171924, 2171924, 2171924, 2171924, 2171924, 2171924, 2171924, 2171924, 2171924, 2171924, 2171924, 2171924, 2171924, 2171924, 2171924, 2171924,
2171924, 2175330, 2176728, 2177793, 2181101, 2182499, 2182499, 2182853, 2184015, 2185188, 2185580, 2185930, 2186933, 2190241, 2191403, 2192316,
2195230, 2204757, 2208118, 2211108, 2220417, 2223778, 2224940, 2225866, 2228818, 2232125, 2233141, 2234172, 2237086, 2246395, 2249347, 2251991,
}, {
/// --------------------------------------------------------------------- 0x2 ---------------------------------------------------------------------
}, {
/// --------------------------------------------------------------------- 0x2 ---------------------------------------------------------------------
0, 9527, 12991, 16067, 25594, 29058, 30527, 31657, 35121, 38525, 39766, 41041, 44445, 53972, 57436, 60512,
70039, 70039, 70039, 70039, 70039, 70039, 70039, 70039, 70039, 70039, 70039, 70039, 70039, 70039, 70039, 70039,
70039, 73503, 74972, 76102, 79566, 79566, 79566, 79566, 79566, 80807, 81333, 81729, 82970, 86434, 87903, 89033,
@ -777,10 +783,10 @@ namespace klotski {
2857120, 2857120, 2857120, 2857120, 2857120, 2857120, 2857120, 2857120, 2857120, 2857120, 2857120, 2857120, 2857120, 2857120, 2857120, 2857120,
2857120, 2860584, 2861982, 2863068, 2866429, 2866429, 2866429, 2866429, 2866429, 2867623, 2868015, 2868327, 2869343, 2872704, 2873866, 2874792,
2877744, 2887271, 2890632, 2893622, 2902931, 2906292, 2907454, 2908380, 2911332, 2914639, 2915655, 2916686, 2919600, 2928909, 2931861, 2934505,
}, {
/// --------------------------------------------------------------------- 0x3 ---------------------------------------------------------------------
}, {
/// --------------------------------------------------------------------- 0x4 ---------------------------------------------------------------------
}, {
/// --------------------------------------------------------------------- 0x3 ---------------------------------------------------------------------
}, {
/// --------------------------------------------------------------------- 0x4 ---------------------------------------------------------------------
0, 9527, 9527, 12933, 22460, 25924, 27393, 28523, 31987, 35451, 35451, 36920, 40384, 49911, 49911, 53317,
62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844,
62844, 66308, 67777, 68907, 72371, 72371, 72371, 72371, 72371, 73840, 73840, 74366, 75835, 79299, 80768, 81898,
@ -1037,8 +1043,8 @@ namespace klotski {
2242744, 2242744, 2242744, 2242744, 2242744, 2242744, 2242744, 2242744, 2242744, 2242744, 2242744, 2242744, 2242744, 2242744, 2242744, 2242744,
2242744, 2246208, 2247606, 2248692, 2252053, 2252053, 2252053, 2252053, 2252053, 2253451, 2253451, 2253843, 2255005, 2258366, 2259528, 2260454,
2263406, 2272933, 2272933, 2276241, 2285550, 2288911, 2290073, 2290999, 2293951, 2297312, 2297312, 2298474, 2301426, 2310735, 2310735, 2313649,
}, {
/// --------------------------------------------------------------------- 0x5 ---------------------------------------------------------------------
}, {
/// --------------------------------------------------------------------- 0x5 ---------------------------------------------------------------------
0, 8169, 8169, 11633, 19802, 19802, 19802, 19802, 19802, 23266, 23266, 24735, 28199, 36368, 36368, 39832,
48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001,
48001, 51465, 51465, 52706, 56170, 56170, 56170, 56170, 56170, 57639, 57639, 58165, 59634, 63098, 63098, 64339,
@ -1295,8 +1301,8 @@ namespace klotski {
1813321, 1813321, 1813321, 1813321, 1813321, 1813321, 1813321, 1813321, 1813321, 1813321, 1813321, 1813321, 1813321, 1813321, 1813321, 1813321,
1813321, 1816785, 1816785, 1817979, 1821340, 1821340, 1821340, 1821340, 1821340, 1822738, 1822738, 1823130, 1824292, 1827653, 1827653, 1828669,
1831621, 1839790, 1839790, 1843151, 1851170, 1851170, 1851170, 1851170, 1851170, 1854531, 1854531, 1855693, 1858645, 1866664, 1866664, 1869616,
}, {
/// --------------------------------------------------------------------- 0x6 ---------------------------------------------------------------------
}, {
/// --------------------------------------------------------------------- 0x6 ---------------------------------------------------------------------
0, 9527, 9527, 12991, 22518, 25924, 27393, 28639, 32045, 35451, 35451, 36920, 40326, 49853, 49853, 53317,
62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844,
62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844,
@ -1553,10 +1559,10 @@ namespace klotski {
2263406, 2263406, 2263406, 2263406, 2263406, 2263406, 2263406, 2263406, 2263406, 2263406, 2263406, 2263406, 2263406, 2263406, 2263406, 2263406,
2263406, 2263406, 2263406, 2263406, 2263406, 2263406, 2263406, 2263406, 2263406, 2263406, 2263406, 2263406, 2263406, 2263406, 2263406, 2263406,
2263406, 2272933, 2272933, 2276294, 2285603, 2288911, 2290073, 2291090, 2294004, 2297312, 2297312, 2298474, 2301388, 2310697, 2310697, 2313649,
}, {
/// --------------------------------------------------------------------- 0x7 ---------------------------------------------------------------------
}, {
/// --------------------------------------------------------------------- 0x8 ---------------------------------------------------------------------
}, {
/// --------------------------------------------------------------------- 0x7 ---------------------------------------------------------------------
}, {
/// --------------------------------------------------------------------- 0x8 ---------------------------------------------------------------------
0, 8397, 11405, 11405, 19802, 22810, 24085, 25191, 28199, 28199, 28199, 28199, 28199, 36596, 39604, 39604,
48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001,
48001, 51007, 52282, 52282, 55288, 56563, 56563, 57019, 58294, 58294, 58294, 58294, 58294, 61300, 62575, 62575,
@ -1813,8 +1819,8 @@ namespace klotski {
2260408, 2260408, 2260408, 2260408, 2260408, 2260408, 2260408, 2260408, 2260408, 2260408, 2260408, 2260408, 2260408, 2260408, 2260408, 2260408,
2260408, 2263414, 2264635, 2264635, 2267563, 2268784, 2268784, 2269134, 2270165, 2270165, 2270165, 2270165, 2270165, 2273093, 2274124, 2274124,
2276726, 2285123, 2288052, 2288052, 2296275, 2299204, 2300235, 2301148, 2303750, 2303750, 2303750, 2303750, 2303750, 2311973, 2314575, 2314575,
}, {
/// --------------------------------------------------------------------- 0x9 ---------------------------------------------------------------------
}, {
/// --------------------------------------------------------------------- 0x9 ---------------------------------------------------------------------
0, 5741, 8119, 8119, 13860, 16238, 17223, 17223, 19601, 21979, 22964, 22964, 25342, 31083, 33461, 33461,
39202, 39202, 39202, 39202, 39202, 39202, 39202, 39202, 39202, 39202, 39202, 39202, 39202, 39202, 39202, 39202,
39202, 41172, 42157, 42157, 44127, 45112, 45112, 45112, 46097, 46913, 47321, 47321, 48137, 50107, 51092, 51092,
@ -2071,8 +2077,8 @@ namespace klotski {
1826821, 1826821, 1826821, 1826821, 1826821, 1826821, 1826821, 1826821, 1826821, 1826821, 1826821, 1826821, 1826821, 1826821, 1826821, 1826821,
1826821, 1828791, 1829742, 1829742, 1831678, 1832629, 1832629, 1832629, 1833450, 1834245, 1834561, 1834561, 1835264, 1837200, 1838021, 1838021,
1839793, 1845534, 1847857, 1847857, 1853509, 1855832, 1856653, 1856653, 1858741, 1861064, 1861885, 1861885, 1863973, 1869625, 1871713, 1871713,
}, {
/// --------------------------------------------------------------------- 0xA ---------------------------------------------------------------------
}, {
/// --------------------------------------------------------------------- 0xA ---------------------------------------------------------------------
0, 6375, 8925, 11205, 17580, 20130, 21405, 21405, 23955, 26245, 27161, 28131, 30421, 36796, 39346, 41626,
48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001,
48001, 50551, 51826, 52738, 55288, 56563, 56563, 56563, 57838, 58754, 59212, 59600, 60516, 63066, 64341, 65253,
@ -2329,10 +2335,10 @@ namespace klotski {
2258426, 2258426, 2258426, 2258426, 2258426, 2258426, 2258426, 2258426, 2258426, 2258426, 2258426, 2258426, 2258426, 2258426, 2258426, 2258426,
2258426, 2260976, 2262197, 2263085, 2265581, 2266802, 2266802, 2266802, 2267833, 2268724, 2269074, 2269382, 2270165, 2272661, 2273692, 2274474,
2276726, 2283101, 2285597, 2287829, 2294096, 2296592, 2297623, 2297623, 2299875, 2302115, 2302898, 2303708, 2305732, 2311999, 2314251, 2316271,
}, {
/// --------------------------------------------------------------------- 0xB ---------------------------------------------------------------------
}, {
/// --------------------------------------------------------------------- 0xC ---------------------------------------------------------------------
}, {
/// --------------------------------------------------------------------- 0xB ---------------------------------------------------------------------
}, {
/// --------------------------------------------------------------------- 0xC ---------------------------------------------------------------------
0, 8281, 11299, 14237, 22518, 25536, 26811, 27781, 30799, 34205, 35451, 36920, 40326, 48607, 51625, 54563,
62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844,
62844, 65794, 67069, 68121, 71071, 72346, 72346, 72746, 74021, 75233, 75759, 76285, 77497, 80447, 81722, 82774,
@ -2589,8 +2595,8 @@ namespace klotski {
2863318, 2863318, 2863318, 2863318, 2863318, 2863318, 2863318, 2863318, 2863318, 2863318, 2863318, 2863318, 2863318, 2863318, 2863318, 2863318,
2863318, 2866268, 2867489, 2868509, 2871385, 2872606, 2872606, 2872918, 2873949, 2875119, 2875511, 2875903, 2876905, 2879781, 2880812, 2881698,
2884262, 2892543, 2895480, 2898347, 2906459, 2909396, 2910427, 2911237, 2913843, 2917151, 2918168, 2919330, 2922244, 2930356, 2932962, 2935522,
}, {
/// --------------------------------------------------------------------- 0xD ---------------------------------------------------------------------
}, {
/// --------------------------------------------------------------------- 0xD ---------------------------------------------------------------------
0, 6466, 8786, 11114, 17580, 19900, 20885, 21726, 24046, 26336, 27161, 28131, 30421, 36887, 39207, 41535,
48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001, 48001,
48001, 50319, 51304, 52144, 54462, 55447, 55447, 55795, 56780, 57600, 57950, 58300, 59120, 61438, 62423, 63263,
@ -2847,8 +2853,8 @@ namespace klotski {
2198750, 2198750, 2198750, 2198750, 2198750, 2198750, 2198750, 2198750, 2198750, 2198750, 2198750, 2198750, 2198750, 2198750, 2198750, 2198750,
2198750, 2201068, 2202019, 2202835, 2205104, 2206055, 2206055, 2206333, 2207154, 2207952, 2208230, 2208508, 2209212, 2211481, 2212302, 2213018,
2215068, 2221534, 2223804, 2226081, 2232438, 2234708, 2235529, 2236245, 2238295, 2240535, 2241240, 2242050, 2244074, 2250431, 2252481, 2254535,
}, {
/// --------------------------------------------------------------------- 0xE ---------------------------------------------------------------------
}, {
/// --------------------------------------------------------------------- 0xE ---------------------------------------------------------------------
0, 8542, 11618, 14338, 22880, 25956, 27231, 28346, 31422, 34550, 35680, 36836, 39964, 48506, 51582, 54302,
62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844, 62844,
62844, 65840, 67115, 68075, 71071, 72346, 72346, 72792, 74067, 75163, 75631, 76039, 77135, 80131, 81406, 82366,
@ -3105,7 +3111,8 @@ namespace klotski {
2863600, 2863600, 2863600, 2863600, 2863600, 2863600, 2863600, 2863600, 2863600, 2863600, 2863600, 2863600, 2863600, 2863600, 2863600, 2863600,
2863600, 2866596, 2867817, 2868747, 2871667, 2872888, 2872888, 2873234, 2874265, 2875324, 2875678, 2875994, 2876905, 2879825, 2880856, 2881664,
2884262, 2892804, 2895794, 2898444, 2906802, 2909792, 2910823, 2911738, 2914382, 2917419, 2918345, 2919284, 2921962, 2930320, 2932964, 2935326,
}, {
/// --------------------------------------------------------------------- 0xF ---------------------------------------------------------------------
}};
}
}, {
/// --------------------------------------------------------------------- 0xF ---------------------------------------------------------------------
}};
} // namespace klotski

Loading…
Cancel
Save