Skip to content

Commit

Permalink
Implement Musketeer chess
Browse files Browse the repository at this point in the history
- Change move encoding to support up to 64 promotion piece types.
- Support limited distance sliders.
- Support mixed leaping/sliding pieces and asymmetric pieces.
- Reduce number of places that have to be touched when adding pieces.
- Support setup phase and gating.
  • Loading branch information
ianfab committed Jun 16, 2018
1 parent a834bfe commit c4bfae8
Show file tree
Hide file tree
Showing 17 changed files with 1,021 additions and 424 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
stockfish
*.o
.depend
82 changes: 41 additions & 41 deletions src/benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,58 +32,58 @@ namespace {
const vector<string> Defaults = {
"setoption name UCI_Chess960 value false",
"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",
"r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 10",
"8/2p5/3p4/KP5r/1R3p1k/8/4P1P1/8 w - - 0 11",
"4rrk1/pp1n3p/3q2pQ/2p1pb2/2PP4/2P3N1/P2B2PP/4RRK1 b - - 7 19",
"rq3rk1/ppp2ppp/1bnpb3/3N2B1/3NP3/7P/PPPQ1PP1/2KR3R w - - 7 14 moves d4e6",
"r1bq1r1k/1pp1n1pp/1p1p4/4p2Q/4Pp2/1BNP4/PPP2PPP/3R1RK1 w - - 2 14 moves g2g4",
"r3r1k1/2p2ppp/p1p1bn2/8/1q2P3/2NPQN2/PPP3PP/R4RK1 b - - 2 15",
"r1bbk1nr/pp3p1p/2n5/1N4p1/2Np1B2/8/PPP2PPP/2KR1B1R w kq - 0 13",
"r1bq1rk1/ppp1nppp/4n3/3p3Q/3P4/1BP1B3/PP1N2PP/R4RK1 w - - 1 16",
"4r1k1/r1q2ppp/ppp2n2/4P3/5Rb1/1N1BQ3/PPP3PP/R5K1 w - - 1 17",
"2rqkb1r/ppp2p2/2npb1p1/1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
"8/8/8/5N2/8/p7/8/2NK3k[C-L-c-l-] w - - 0 1", // Na2 - mate
"8/3k4/8/8/8/4B3/4KB2/2B5[C-L-c-l-] w - - 0 1", // draw

// 6-man positions
"8/8/1P6/5pr1/8/4R3/7k/2K5 w - - 0 1", // Re5 - mate
"8/2p4P/8/kr6/6R1/8/8/1K6 w - - 0 1", // Ka2 - mate
"8/8/3P3k/8/1p6/8/1P6/1K3n2 b - - 0 1", // Nd2 - draw
"8/8/1P6/5pr1/8/4R3/7k/2K5[C-L-c-l-] w - - 0 1", // Re5 - mate
"8/2p4P/8/kr6/6R1/8/8/1K6[C-L-c-l-] w - - 0 1", // Ka2 - mate
"8/8/3P3k/8/1p6/8/1P6/1K3n2[C-L-c-l-] b - - 0 1", // Nd2 - draw

// 7-man positions
"8/R7/2q5/8/6k1/8/1P5p/K6R w - - 0 124", // Draw
"8/R7/2q5/8/6k1/8/1P5p/K6R[C-L-c-l-] w - - 0 124", // Draw

// Mate and stalemate positions
"6k1/3b3r/1p1p4/p1n2p2/1PPNpP1q/P3Q1p1/1R1RB1P1/5K2 b - - 0 1",
"r2r1n2/pp2bk2/2p1p2p/3q4/3PN1QP/2P3R1/P4PP1/5RK1 w - - 0 1",
"8/8/8/8/8/6k1/6p1/6K1 w - -",
"7k/7P/6K1/8/3B4/8/8/8 b - -",
"6k1/3b3r/1p1p4/p1n2p2/1PPNpP1q/P3Q1p1/1R1RB1P1/5K2[C-L-c-l-] b - - 0 1",
"r2r1n2/pp2bk2/2p1p2p/3q4/3PN1QP/2P3R1/P4PP1/5RK1[C-L-c-l-] w - - 0 1",
"8/8/8/8/8/6k1/6p1/6K1[C-L-c-l-] w - -",
"7k/7P/6K1/8/3B4/8/8/8[C-L-c-l-] b - -",

// Chess 960
"setoption name UCI_Chess960 value true",
"bbqnnrkr/pppppppp/8/8/8/8/PPPPPPPP/BBQNNRKR w KQkq - 0 1 moves g2g3 d7d5 d2d4 c8h3 c1g5 e8d6 g5e7 f7f6",
"bbqnnrkr/pppppppp/8/8/8/8/PPPPPPPP/BBQNNRKR[C-L-c-l-] w KQkq - 0 1 moves g2g3 d7d5 d2d4 c8h3 c1g5 e8d6 g5e7 f7f6",
"setoption name UCI_Chess960 value false"
};

Expand Down
10 changes: 5 additions & 5 deletions src/bitbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,21 +117,21 @@ namespace {
if ( distance(ksq[WHITE], ksq[BLACK]) <= 1
|| ksq[WHITE] == psq
|| ksq[BLACK] == psq
|| (us == WHITE && (PawnAttacks[WHITE][psq] & ksq[BLACK])))
|| (us == WHITE && (PseudoAttacks[WHITE][PAWN][psq] & ksq[BLACK])))
result = INVALID;

// Immediate win if a pawn can be promoted without getting captured
else if ( us == WHITE
&& rank_of(psq) == RANK_7
&& ksq[us] != psq + NORTH
&& ( distance(ksq[~us], psq + NORTH) > 1
|| (PseudoAttacks[KING][ksq[us]] & (psq + NORTH))))
|| (PseudoAttacks[us][KING][ksq[us]] & (psq + NORTH))))
result = WIN;

// Immediate draw if it is a stalemate or a king captures undefended pawn
else if ( us == BLACK
&& ( !(PseudoAttacks[KING][ksq[us]] & ~(PseudoAttacks[KING][ksq[~us]] | PawnAttacks[~us][psq]))
|| (PseudoAttacks[KING][ksq[us]] & psq & ~PseudoAttacks[KING][ksq[~us]])))
&& ( !(PseudoAttacks[us][KING][ksq[us]] & ~(PseudoAttacks[us][KING][ksq[~us]] | PseudoAttacks[~us][PAWN][psq]))
|| (PseudoAttacks[us][KING][ksq[us]] & psq & ~PseudoAttacks[us][KING][ksq[~us]])))
result = DRAW;

// Position will be classified later
Expand All @@ -157,7 +157,7 @@ namespace {
constexpr Result Bad = (Us == WHITE ? DRAW : WIN);

Result r = INVALID;
Bitboard b = PseudoAttacks[KING][ksq[Us]];
Bitboard b = PseudoAttacks[Us][KING][ksq[Us]];

while (b)
r |= Us == WHITE ? db[index(Them, ksq[Them] , pop_lsb(&b), psq)]
Expand Down
140 changes: 100 additions & 40 deletions src/bitboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ Bitboard DistanceRingBB[SQUARE_NB][8];
Bitboard ForwardFileBB[COLOR_NB][SQUARE_NB];
Bitboard PassedPawnMask[COLOR_NB][SQUARE_NB];
Bitboard PawnAttackSpan[COLOR_NB][SQUARE_NB];
Bitboard PseudoAttacks[PIECE_TYPE_NB][SQUARE_NB];
Bitboard PawnAttacks[COLOR_NB][SQUARE_NB];
Bitboard PseudoAttacks[COLOR_NB][PIECE_TYPE_NB][SQUARE_NB];
Bitboard LeaperAttacks[COLOR_NB][PIECE_TYPE_NB][SQUARE_NB];

Magic RookMagics[SQUARE_NB];
Magic BishopMagics[SQUARE_NB];
Expand All @@ -58,6 +58,24 @@ namespace {
u = ((u >> 4) + u) & 0x0F0FU;
return (u * 0x0101U) >> 8;
}

Bitboard sliding_attack(Direction directions[], Square sq, Bitboard occupied, int max_dist = 7) {

Bitboard attack = 0;

for (int i = 0; directions[i]; ++i)
for (Square s = sq + directions[i];
is_ok(s) && distance(s, s - directions[i]) == 1 && distance(s, sq) <= max_dist;
s += directions[i])
{
attack |= s;

if (occupied & s)
break;
}

return attack;
}
}


Expand Down Expand Up @@ -119,69 +137,111 @@ void Bitboards::init() {
DistanceRingBB[s1][SquareDistance[s1][s2] - 1] |= s2;
}

int steps[][5] = { {}, { 7, 9 }, { 6, 10, 15, 17 }, {}, {}, {}, { 1, 7, 8, 9 } };
// Piece moves
Direction RookDirections[5] = { NORTH, EAST, SOUTH, WEST };
Direction BishopDirections[5] = { NORTH_EAST, SOUTH_EAST, SOUTH_WEST, NORTH_WEST };

init_magics(RookTable, RookMagics, RookDirections);
init_magics(BishopTable, BishopMagics, BishopDirections);

int steps[][17] = {
{}, // NO_PIECE_TYPE
{ 7, 9 }, // Pawn
{ -17, -15, -10, -6, 6, 10, 15, 17 }, // Knight
{}, // Bishop
{}, // Rook
{}, // Queen
{ -16, -10, -9, -8, -7, -6, -2, -1,
16, 10, 9, 8, 7, 6, 2, 1 }, // Cannon
{ -17, -15, -10, -6, 6, 10, 15, 17 }, // Leopard
{ -17, -15, -10, -6, 6, 10, 15, 17 }, // Archbishop
{ -17, -15, -10, -6, 6, 10, 15, 17 }, // Chancellor
{ -17, -16, -15, -10, -6, -2,
17, 16, 15, 10, 6, 2 }, // Spider
{ -17, -15, -10, -6, 6, 10, 15, 17 }, // Dragon
{ -25, -23, -17, -15, -11, -10, -6, -5,
25, 23, 17, 15, 11, 10, 6, 5}, // Unicorn
{ -27, -24, -21, -18, -16, -14, -3, -2,
27, 24, 21, 18, 16, 14, 3, 2 }, // Hawk
{ -18, -16, -14, -9, -8, -7, -2, -1,
18, 16, 14, 9, 8, 7, 2, 1 }, // Elephant
{ -17, -16, -15, -2,
17, 16, 15, 2 }, // Fortress
{ -9, -8, -7, -1, 1, 7, 8, 9 } // King
};
Direction slider[][9] = {
{}, // NO_PIECE_TYPE
{}, // Pawn
{}, // Knight
{ NORTH_EAST, SOUTH_EAST, SOUTH_WEST, NORTH_WEST }, // Bishop
{ NORTH, EAST, SOUTH, WEST }, // Rook
{ NORTH, EAST, SOUTH, WEST, NORTH_EAST, SOUTH_EAST, SOUTH_WEST, NORTH_WEST }, // Queen
{}, // Cannon
{ NORTH_EAST, SOUTH_EAST, SOUTH_WEST, NORTH_WEST }, // Leopard
{ NORTH_EAST, SOUTH_EAST, SOUTH_WEST, NORTH_WEST }, // Archbishop
{ NORTH, EAST, SOUTH, WEST }, // Chancellor
{ NORTH_EAST, SOUTH_EAST, SOUTH_WEST, NORTH_WEST }, // Spider
{ NORTH, EAST, SOUTH, WEST, NORTH_EAST, SOUTH_EAST, SOUTH_WEST, NORTH_WEST }, // Dragon
{}, // Unicorn
{}, // Hawk
{}, // Elephant
{ NORTH_EAST, SOUTH_EAST, SOUTH_WEST, NORTH_WEST }, // Fortress
{} // King
};
int slider_dist[] = {
0, // NO_PIECE_TYPE
0, // Pawn
0, // Knight
7, // Bishop
7, // Rook
7, // Queen
0, // Cannon
2, // Leopard
7, // Archbishop
7, // Chancellor
2, // Spider
7, // Dragon
0, // Unicorn
0, // Hawk
0, // Elephant
3, // Fortress
0 // King
};

for (Color c = WHITE; c <= BLACK; ++c)
for (PieceType pt : { PAWN, KNIGHT, KING })
for (PieceType pt = PAWN; pt <= KING; ++pt)
for (Square s = SQ_A1; s <= SQ_H8; ++s)
{
for (int i = 0; steps[pt][i]; ++i)
{
Square to = s + Direction(c == WHITE ? steps[pt][i] : -steps[pt][i]);

if (is_ok(to) && distance(s, to) < 3)
if (is_ok(to) && distance(s, to) < 4)
{
if (pt == PAWN)
PawnAttacks[c][s] |= to;
else
PseudoAttacks[pt][s] |= to;
PseudoAttacks[c][pt][s] |= to;
LeaperAttacks[c][pt][s] |= to;
}
}

Direction RookDirections[] = { NORTH, EAST, SOUTH, WEST };
Direction BishopDirections[] = { NORTH_EAST, SOUTH_EAST, SOUTH_WEST, NORTH_WEST };

init_magics(RookTable, RookMagics, RookDirections);
init_magics(BishopTable, BishopMagics, BishopDirections);
PseudoAttacks[c][pt][s] |= sliding_attack(slider[pt], s, 0, slider_dist[pt]);
}

for (Square s1 = SQ_A1; s1 <= SQ_H8; ++s1)
{
PseudoAttacks[QUEEN][s1] = PseudoAttacks[BISHOP][s1] = attacks_bb<BISHOP>(s1, 0);
PseudoAttacks[QUEEN][s1] |= PseudoAttacks[ ROOK][s1] = attacks_bb< ROOK>(s1, 0);

for (PieceType pt : { BISHOP, ROOK })
for (Square s2 = SQ_A1; s2 <= SQ_H8; ++s2)
{
if (!(PseudoAttacks[pt][s1] & s2))
if (!(PseudoAttacks[WHITE][pt][s1] & s2))
continue;

LineBB[s1][s2] = (attacks_bb(pt, s1, 0) & attacks_bb(pt, s2, 0)) | s1 | s2;
BetweenBB[s1][s2] = attacks_bb(pt, s1, SquareBB[s2]) & attacks_bb(pt, s2, SquareBB[s1]);
LineBB[s1][s2] = (attacks_bb(WHITE, pt, s1, 0) & attacks_bb(WHITE, pt, s2, 0)) | s1 | s2;
BetweenBB[s1][s2] = attacks_bb(WHITE, pt, s1, SquareBB[s2]) & attacks_bb(WHITE, pt, s2, SquareBB[s1]);
}
}
}


namespace {

Bitboard sliding_attack(Direction directions[], Square sq, Bitboard occupied) {

Bitboard attack = 0;

for (int i = 0; i < 4; ++i)
for (Square s = sq + directions[i];
is_ok(s) && distance(s, s - directions[i]) == 1;
s += directions[i])
{
attack |= s;

if (occupied & s)
break;
}

return attack;
}


// init_magics() computes all rook and bishop attacks at startup. Magic
// bitboards are used to look up attacks of sliding pieces. As a reference see
// chessprogramming.wikispaces.com/Magic+Bitboards. In particular, here we
Expand Down
19 changes: 5 additions & 14 deletions src/bitboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ extern Bitboard DistanceRingBB[SQUARE_NB][8];
extern Bitboard ForwardFileBB[COLOR_NB][SQUARE_NB];
extern Bitboard PassedPawnMask[COLOR_NB][SQUARE_NB];
extern Bitboard PawnAttackSpan[COLOR_NB][SQUARE_NB];
extern Bitboard PseudoAttacks[PIECE_TYPE_NB][SQUARE_NB];
extern Bitboard PawnAttacks[COLOR_NB][SQUARE_NB];
extern Bitboard PseudoAttacks[COLOR_NB][PIECE_TYPE_NB][SQUARE_NB];
extern Bitboard LeaperAttacks[COLOR_NB][PIECE_TYPE_NB][SQUARE_NB];


/// Magic holds all magic bitboards relevant data for a single square
Expand Down Expand Up @@ -267,24 +267,15 @@ template<> inline int distance<Rank>(Square x, Square y) { return distance(rank_
template<PieceType Pt>
inline Bitboard attacks_bb(Square s, Bitboard occupied) {

assert(Pt == BISHOP || Pt == ROOK);
const Magic& m = Pt == ROOK ? RookMagics[s] : BishopMagics[s];
return m.attacks[m.index(occupied)];
}

inline Bitboard attacks_bb(PieceType pt, Square s, Bitboard occupied) {

assert(pt != PAWN);

switch (pt)
{
case BISHOP: return attacks_bb<BISHOP>(s, occupied);
case ROOK : return attacks_bb< ROOK>(s, occupied);
case QUEEN : return attacks_bb<BISHOP>(s, occupied) | attacks_bb<ROOK>(s, occupied);
default : return PseudoAttacks[pt][s];
}
inline Bitboard attacks_bb(Color c, PieceType pt, Square s, Bitboard occupied) {
return LeaperAttacks[c][pt][s] | (PseudoAttacks[c][pt][s] & (attacks_bb<BISHOP>(s, occupied) | attacks_bb<ROOK>(s, occupied)));
}


/// popcount() counts the number of non-zero bits in a bitboard

inline int popcount(Bitboard b) {
Expand Down
Loading

0 comments on commit c4bfae8

Please sign in to comment.