mirror of https://github.com/dnomd343/klotski.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
1.4 KiB
73 lines
1.4 KiB
#ifndef _KLOTSKI_H_
|
|
#define _KLOTSKI_H_
|
|
|
|
#include <cstdint>
|
|
|
|
#define B_space 0x0
|
|
#define B_fill 0x7
|
|
#define B_1x2 0x1
|
|
#define B_2x1 0x2
|
|
#define B_1x1 0x3
|
|
#define B_2x2 0x4
|
|
|
|
#define C_1x1 uint64_t(0x3)
|
|
#define C_1x2 uint64_t(0x39)
|
|
#define C_2x1 uint64_t(0x7002)
|
|
#define C_2x2 uint64_t(0x3F03C)
|
|
|
|
#define F_1x1 uint64_t(0x7)
|
|
#define F_1x2 uint64_t(0x3F)
|
|
#define F_2x1 uint64_t(0x7007)
|
|
#define F_2x2 uint64_t(0x3F03F)
|
|
|
|
uint64_t compact_code(uint64_t code);
|
|
uint64_t extract_code(uint64_t code);
|
|
|
|
#endif
|
|
|
|
/*
|
|
|
|
uint64_t -> 0000 + [xxx] * 20
|
|
|
|
2x2 2x1 1x2 1x1
|
|
# # # # # #
|
|
# # #
|
|
|
|
00 01 02 03
|
|
04 05 06 07
|
|
08 09 10 11
|
|
12 13 14 15
|
|
16 17 18 19
|
|
|
|
x1 (%4) => 0 1 2 3
|
|
x3 (%4) => 0 3 2 1
|
|
|
|
*/
|
|
|
|
/*
|
|
======================================================
|
|
|
|
1x1 -> 011 000 000 000 -> 0000 0000 0011 -> 0x3
|
|
|
|
1x2 -> 001 111 000 000 -> 0000 0011 1001 -> 0x39
|
|
|
|
2x1 -> 010 000 000 000 -> 0000 0000 0010 -> 0x7002
|
|
111 000 000 000 -> 0000 0000 0111
|
|
|
|
2x2 -> 100 111 000 000 -> 0000 0011 1100 -> 0x3F03C
|
|
111 111 000 000 -> 0000 0011 1111
|
|
|
|
======================================================
|
|
|
|
1x1 -> 111 000 000 000 -> 0000 0000 0111 -> 0x7
|
|
|
|
1x2 -> 111 111 000 000 -> 0000 0011 1111 -> 0x3F
|
|
|
|
2x1 -> 111 000 000 000 -> 0000 0000 0111 -> 0x7007
|
|
111 000 000 000 -> 0000 0000 0111
|
|
|
|
2x2 -> 111 111 000 000 -> 0000 0011 1111 -> 0x3F03F
|
|
111 111 000 000 -> 0000 0011 1111
|
|
|
|
======================================================
|
|
*/
|
|
|