Browse Source

docs: update RawCode description

legacy
Dnomd343 2 years ago
parent
commit
b7cbc6513c
  1. 31
      src/klotski_core/raw_code/raw_code.h

31
src/klotski_core/raw_code/raw_code.h

@ -1,13 +1,14 @@
#pragma once #pragma once
/// RawCode is an uncompressed coding scheme, which is used for program calculation. /// RawCode is an uncompressed coding scheme, which is used for program calculation. It
/// It encodes a `5x4` chessboard as `0 ~ 19`, and uses 3-bits to represent each position, /// encodes a `5x4` chessboard as `0 ~ 19`, and uses 3-bits to represent each position,
/// occupying a total of 60-bits, and stored in a `uint64_t` variable. /// occupying a total of 60-bits, and stored in a `uint64_t` variable. Among them, the
/// upper 4-bits are reserved and filled with `0`.
/// ///
/// 00 01 02 03 /// 00 01 02 03
/// 04 05 06 07 fill 20-slots /// 04 05 06 07 fill 20-slots
/// 08 09 10 11 0000 (19) (18) (17) (16) ... (03) (02) (01) (00) /// 08 09 10 11 0000 (19) (18) (17) (16) ... (03) (02) (01) (00)
/// 12 13 14 15 (4b) (60b) /// 12 13 14 15 (4b) + (3b) * 20 => 64-bits
/// 16 17 18 19 /// 16 17 18 19
/// ///
/// Eg1: /// Eg1:
@ -17,10 +18,11 @@
/// @ & * @ ... 1x1 1x1 ... 111 011 011 111 /// @ & * @ ... 1x1 1x1 ... 111 011 011 111
/// * & 1x1 0x0 0x0 1x1 011 000 000 011 /// * & 1x1 0x0 0x0 1x1 011 000 000 011
/// ///
/// 19 18 17 16 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 /// | 19 18 17 16 | 15 14 13 12 | 11 10 09 08 | 07 06 05 04 | 03 02 01 00
/// 0000 011 000 000 011 111 011 011 111 010 111 001 010 111 111 111 111 010 111 100 010 /// 0000 | 011 000 000 011 | 111 011 011 111 | 010 111 001 010 | 111 111 111 111 | 010 111 100 010
/// 0000 0110 0000 0011 1110 1101 1111 0101 1100 1010 1111 1111 1111 0101 1110 0010 /// 0000 | 0110 0000 0011 | 1110 1101 1111 | 0101 1100 1010 | 1111 1111 1111 | 0101 1110 0010
/// 0 6 0 3 E D F 5 C A F F F 5 E 2 /// 0 6 0 3 E D F 5 C A F F F 5 E 2
/// => 0x0603'EDF5'CAFF'F5E2
/// ///
/// Eg2: /// Eg2:
/// * @ & % 1x1 1x1 1x1 2x1 011 011 011 010 /// * @ & % 1x1 1x1 1x1 2x1 011 011 011 010
@ -29,10 +31,11 @@
/// ~ ~ ^ 0x0 1x2 ... ... 000 001 111 111 /// ~ ~ ^ 0x0 1x2 ... ... 000 001 111 111
/// @ % % 0x0 1x1 1x2 ... 000 011 001 111 /// @ % % 0x0 1x1 1x2 ... 000 011 001 111
/// ///
/// 19 18 17 16 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 /// | 19 18 17 16 | 15 14 13 12 | 11 10 09 08 | 07 06 05 04 | 03 02 01 00
/// 0000 111 001 011 000 111 111 001 000 010 111 111 111 111 010 111 100 010 011 011 011 /// 0000 | 111 001 011 000 | 111 111 001 000 | 010 111 111 111 | 111 010 111 100 | 010 011 011 011
/// 0000 1110 0101 1000 1111 1100 1000 0101 1111 1111 1110 1011 1100 0100 1101 1011 /// 0000 | 1110 0101 1000 | 1111 1100 1000 | 0101 1111 1111 | 1110 1011 1100 | 0100 1101 1011
/// 0 E 5 8 F C 8 5 F F E B C 4 D B /// 0 E 5 8 F C 8 5 F F E B C 4 D B
/// => 0x0E58'FC85'FFEB'C4DB
#include <string> #include <string>
#include <cstdint> #include <cstdint>

Loading…
Cancel
Save