Skip to content

Commit

Permalink
add Snort (fairy-stockfish#721)
Browse files Browse the repository at this point in the history
  • Loading branch information
RainRat authored Sep 15, 2023
1 parent 1355f7e commit cd412cc
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/bitboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
3 changes: 2 additions & 1 deletion src/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 6 additions & 0 deletions src/position.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ enum ChasingRule {
};

enum EnclosingRule {
NO_ENCLOSING, REVERSI, ATAXX, QUADWRANGLE
NO_ENCLOSING, REVERSI, ATAXX, QUADWRANGLE, SNORT
};

enum OptBool {
Expand Down
14 changes: 13 additions & 1 deletion src/variants.ini
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
# [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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit cd412cc

Please sign in to comment.