44 {
"Knight", 1, 4, { { 1, 2 }, { 2, 1 }, { 2, -1, }, { 1, -2 } } },
45 {
"King", 1, 4, { { 0, 1 }, { 1, 0 }, { 1, 1 }, { 1, -1 } } },
46 {
"Bishop", 8, 2, { { 1, 1 }, { 1, -1 } } },
47 {
"Rook", 8, 2, { { 0, 1 }, { 1, 0 } } },
48 {
"Queen", 8, 4, { { 0, 1 }, { 1, 0 }, { 1, 1 }, { 1, -1 } } }
51 uint64_t colrow2mask(
int col,
int row)
53 return CW_MASK_T_CONST(1) << ((col << 3) + row);
58 for (
int p = 0; p < 5; ++p)
60 cout <<
"// " << piece[p].name <<
'\n';
61 for (
int col = 0; col < 8; ++col)
63 for (
int row = 0; row < 8; ++row)
66 for (
int dir = 0; dir < piece[p].nrdirs; ++dir)
68 for (
int depth = -piece[p].depth; depth <= piece[p].depth; ++depth)
72 int tcol = col + depth * piece[p].direction[dir].x;
73 if (tcol < 0 || tcol > 7)
75 int trow = row + depth * piece[p].direction[dir].y;
76 if (trow < 0 || trow > 7)
78 mask |= colrow2mask(tcol, trow);
81 std::cout << std::hex <<
"{ CW_MASK_T_CONST(0x" << std::setfill(
'0') << std::setw(16) << mask <<
") }, ";