Support Courier chess
authorFabian Fichter <ianfab@users.noreply.github.com>
Sat, 6 Oct 2018 17:34:25 +0000 (19:34 +0200)
committerFabian Fichter <ianfab@users.noreply.github.com>
Sun, 7 Oct 2018 14:40:23 +0000 (16:40 +0200)
Introduce piece type wazir to support courier chess.

bench: 4648488

src/bitboard.cpp
src/psqt.cpp
src/types.h
src/variant.cpp

index 94cf477..872bd2b 100644 (file)
@@ -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
   };
index 13a0796..c646508 100644 (file)
@@ -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 {
index 634553b..f54e913 100644 (file)
@@ -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
index e56f626..b26ff35 100644 (file)
@@ -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
 }