From 674c4b31ef2908b1ef080e64bf7003ed46f3d623 Mon Sep 17 00:00:00 2001 From: Fabian Fichter Date: Sat, 6 Oct 2018 19:34:25 +0200 Subject: [PATCH] Support Courier chess Introduce piece type wazir to support courier chess. bench: 4648488 --- src/bitboard.cpp | 6 ++++++ src/psqt.cpp | 4 ++-- src/types.h | 3 ++- src/variant.cpp | 19 +++++++++++++++++++ 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/bitboard.cpp b/src/bitboard.cpp index 94cf477..872bd2b 100644 --- a/src/bitboard.cpp +++ b/src/bitboard.cpp @@ -448,6 +448,7 @@ void Bitboards::init() { { SOUTH, WEST, EAST, NORTH }, // clobber { NORTH_WEST, NORTH_EAST }, // breakthrough {}, // immobile + { SOUTH, WEST, EAST, NORTH }, // wazir { SOUTH_WEST, SOUTH, SOUTH_EAST, WEST, EAST, NORTH_WEST, NORTH, NORTH_EAST }, // commoner { SOUTH_WEST, SOUTH, SOUTH_EAST, WEST, EAST, NORTH_WEST, NORTH, NORTH_EAST } // king }; @@ -483,6 +484,7 @@ void Bitboards::init() { {}, // clobber { NORTH_WEST, NORTH, NORTH_EAST }, // breakthrough {}, // immobile + { SOUTH, WEST, EAST, NORTH }, // wazir { SOUTH_WEST, SOUTH, SOUTH_EAST, WEST, EAST, NORTH_WEST, NORTH, NORTH_EAST }, // commoner { SOUTH_WEST, SOUTH, SOUTH_EAST, WEST, EAST, NORTH_WEST, NORTH, NORTH_EAST } // king }; @@ -512,6 +514,7 @@ void Bitboards::init() { {}, // clobber {}, // breakthrough {}, // immobile + {}, // wazir {}, // commoner {} // king }; @@ -541,6 +544,7 @@ void Bitboards::init() { {}, // clobber {}, // breakthrough {}, // immobile + {}, // wazir {}, // commoner {} // king }; @@ -570,6 +574,7 @@ void Bitboards::init() { 0, // clobber 0, // breakthrough 0, // immobile + 0, // wazir 0, // commoner 0 // king }; @@ -599,6 +604,7 @@ void Bitboards::init() { 0, // clobber 0, // breakthrough 0, // immobile + 0, // wazir 0, // commoner 0 // king }; diff --git a/src/psqt.cpp b/src/psqt.cpp index 13a0796..c646508 100644 --- a/src/psqt.cpp +++ b/src/psqt.cpp @@ -27,12 +27,12 @@ Value PieceValue[PHASE_NB][PIECE_NB] = { FersValueMg, AlfilValueMg, SilverValueMg, AiwokValueMg, BersValueMg, ArchbishopValueMg, ChancellorValueMg, AmazonValueMg, KnibisValueMg, BiskniValueMg, ShogiPawnValueMg, LanceValueMg, ShogiKnightValueMg, EuroShogiKnightValueMg, GoldValueMg, HorseValueMg, - ClobberPieceValueMg, BreakthroughPieceValueMg, ImmobilePieceValueMg, CommonerValueMg }, + ClobberPieceValueMg, BreakthroughPieceValueMg, ImmobilePieceValueMg, WazirValueMg, CommonerValueMg }, { VALUE_ZERO, PawnValueEg, KnightValueEg, BishopValueEg, RookValueEg, QueenValueEg, FersValueEg, AlfilValueEg, SilverValueEg, AiwokValueEg, BersValueEg, ArchbishopValueMg, ChancellorValueEg, AmazonValueEg, KnibisValueMg, BiskniValueMg, ShogiPawnValueEg, LanceValueEg, ShogiKnightValueEg, EuroShogiKnightValueEg, GoldValueEg, HorseValueEg, - ClobberPieceValueEg, BreakthroughPieceValueEg, ImmobilePieceValueEg, CommonerValueEg } + ClobberPieceValueEg, BreakthroughPieceValueEg, ImmobilePieceValueEg, WazirValueEg, CommonerValueEg } }; namespace PSQT { diff --git a/src/types.h b/src/types.h index 634553b..f54e913 100644 --- a/src/types.h +++ b/src/types.h @@ -222,6 +222,7 @@ enum Value : int { ClobberPieceValueMg = 300, ClobberPieceValueEg = 300, BreakthroughPieceValueMg = 300, BreakthroughPieceValueEg = 300, ImmobilePieceValueMg = 100, ImmobilePieceValueEg = 100, + WazirValueMg = 400, WazirValueEg = 400, CommonerValueMg = 600, CommonerValueEg = 600, MidgameLimit = 15258, EndgameLimit = 3915 @@ -234,7 +235,7 @@ enum PieceType { FERS, MET = FERS, ALFIL, SILVER, KHON = SILVER, AIWOK, BERS, DRAGON = BERS, ARCHBISHOP, CHANCELLOR, AMAZON, KNIBIS, BISKNI, SHOGI_PAWN, LANCE, SHOGI_KNIGHT, EUROSHOGI_KNIGHT, GOLD, HORSE, - CLOBBER_PIECE, BREAKTHROUGH_PIECE, IMMOBILE_PIECE, COMMONER, KING, + CLOBBER_PIECE, BREAKTHROUGH_PIECE, IMMOBILE_PIECE, WAZIR, COMMONER, KING, ALL_PIECES = 0, PIECE_TYPE_NB = 1 << PIECE_TYPE_BITS diff --git a/src/variant.cpp b/src/variant.cpp index e56f626..b26ff35 100644 --- a/src/variant.cpp +++ b/src/variant.cpp @@ -517,6 +517,24 @@ void VariantMap::init() { v->flagMove = true; return v; } (); + const Variant* courier = [&]{ + Variant* v = new Variant(); + v->maxRank = RANK_8; + v->maxFile = FILE_L; + v->remove_piece(QUEEN); + v->add_piece(ALFIL, 'e'); + v->add_piece(FERS, 'f'); + v->add_piece(COMMONER, 'm'); + v->add_piece(WAZIR, 'w'); + v->startFen = "rnebmk1wbenr/1ppppp1pppp1/6f5/p5p4p/P5P4P/6F5/1PPPPP1PPPP1/RNEBMK1WBENR w - - 0 1"; + v->promotionPieceTypes = {FERS}; + v->doubleStep = false; + v->castling = false; + v->bareKingValue = -VALUE_MATE; + v->bareKingMove = true; + v->stalemateValue = -VALUE_MATE; + return v; + } (); #endif // Add to UCI_Variant option @@ -560,6 +578,7 @@ void VariantMap::init() { add("janus", janus); add("embassy", embassy); add("jesonmor", jesonmor); + add("courier", courier); #endif } -- 1.7.0.4