add Snort (#721)
authorRainRat <rainrat78@yahoo.ca>
Fri, 15 Sep 2023 17:10:53 +0000 (10:10 -0700)
committerGitHub <noreply@github.com>
Fri, 15 Sep 2023 17:10:53 +0000 (19:10 +0200)
src/bitboard.cpp
src/parser.cpp
src/position.h
src/types.h
src/variants.ini

index b4671f1..3939296 100644 (file)
@@ -64,7 +64,7 @@ namespace {
 // Some magics need to be split in order to reduce memory consumption.
 // Otherwise on a 12x10 board they can be >100 MB.
 #ifdef LARGEBOARDS
-  Bitboard RookTableH[0x11800];  // To store horizontalrook attacks
+  Bitboard RookTableH[0x11800];  // To store horizontal rook attacks
   Bitboard RookTableV[0x4800];  // To store vertical rook attacks
   Bitboard BishopTable[0x33C00]; // To store bishop attacks
   Bitboard CannonTableH[0x11800];  // To store horizontal cannon attacks
@@ -220,7 +220,7 @@ std::string Bitboards::pretty(Bitboard b) {
 
       s += "| " + std::to_string(1 + r) + "\n+---+---+---+---+---+---+---+---+---+---+---+---+\n";
   }
-  s += "  a   b   c   d   e   f   g   h   i   j   k\n";
+  s += "  a   b   c   d   e   f   g   h   i   j   k   l\n";
 
   return s;
 }
index 078c338..f222a6b 100644 (file)
@@ -106,8 +106,9 @@ namespace {
         target =  value == "reversi"  ? REVERSI
                 : value == "ataxx" ? ATAXX
                 : value == "quadwrangle" ? QUADWRANGLE
+                : value == "snort" ? SNORT
                 : NO_ENCLOSING;
-        return value == "reversi" || value == "ataxx" || value == "quadwrangle" || value == "none";
+        return value == "reversi" || value == "ataxx" || value == "quadwrangle" || value =="snort" || value == "none";
     }
 
     template <> bool set(const std::string& value, Bitboard& target) {
index 2279135..34b0976 100644 (file)
@@ -708,6 +708,12 @@ inline Bitboard Position::drop_region(Color c, PieceType pt) const {
                       b ^= s;
               }
           }
+          else if (enclosing_drop() == SNORT)
+          {
+              Bitboard theirs = pieces(~c);
+              b &=   ~(shift<NORTH     >(theirs) | shift<SOUTH     >(theirs)
+                  | shift<EAST      >(theirs) | shift<WEST      >(theirs));
+          }
           else
           {
               assert(enclosing_drop() == ATAXX);
index a59f867..99c5e1a 100644 (file)
@@ -302,7 +302,7 @@ enum ChasingRule {
 };
 
 enum EnclosingRule {
-  NO_ENCLOSING, REVERSI, ATAXX, QUADWRANGLE
+  NO_ENCLOSING, REVERSI, ATAXX, QUADWRANGLE, SNORT
 };
 
 enum OptBool {
index 60ccfaf..b5c0353 100644 (file)
 # [MaterialCounting]: material counting rules for adjudication [janggi, unweighted, whitedrawodds, blackdrawodds, none]
 # [CountingRule]: makruk, cambodian, or ASEAN counting rules [makruk, cambodian, asean, none]
 # [ChasingRule]: xiangqi chasing rules [axf, none]
-# [EnclosingRule]: reversi or ataxx enclosing rules [reversi, ataxx, quadwrangle, none]
+# [EnclosingRule]: reversi or ataxx enclosing rules [reversi, ataxx, quadwrangle, snort, none]
 
 ### Additional options relevant for usage in Winboard/XBoard
 # A few options only have the purpose of improving compatibility with Winboard/Xboard.
@@ -1704,6 +1704,18 @@ flipEnclosedPieces = ataxx
 pieceDrops = false
 passOnStalemate = false
 
+#https://www.ludii.games/details.php?keyword=Snort
+#also known as Cats & Dogs
+[snort:ataxx]
+immobile = p
+startFen = 8/8/8/8/8/8/8/8
+enclosingDrop = snort
+flipEnclosedPieces = none
+maxRank = 8
+maxFile = 8
+passOnStalemate = false
+stalematePieceCount = false
+
 #https://www.chess.com/variants/blackletter-chess
 [blackletter:chess]
 pieceToCharTable = PNBRQ.......E...M...HKpnbrq.......e...m...hk