#  Sjaak, a program for playing chess variants
#  Copyright (C) 2011  Evert Glebbeek
#
#  This program is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.

# This is a variant description file for Sjaak.
# It can be used to configure Sjaak to play a chess variant by specifying the movement mode of the pieces.
# Empty lines and anything following a # character are ignored.

# To define a variant, begin a line with "Variant: <name>", then follow on subsequent lines with descriptions
# of the board, the pieces used and their movement, and other rules used in the variant.
# There are a number of examples below, but first we'll go into some background.

# THE BOARD AND ZONES
#
# The board size is specified by (files)x(ranks), for instance
#  Board: 8x8
# defines a standard chess board. There are some limits on the size of a board: the number of files
# and ranks needs to be smaller than 16 and the total size of the board needs to be less than 128
# squares. It is currently not possible to define boards that are smaller than 8x8 (this will be added
# eventually).
# For some of the rules, it's necessary to identify a part of the board. This is done by defining a "zone",
# which lists the squares on the board that are part of that zone.
# For instance:
#  Zone: rank2 = a2,b2,c2,d2,e2,f2,g2,h2
#  Zone: rank8 = a8,b8,c8,d8,e8,f8,g8,h8
# defines the 8th rank (rank8) of the board.
# Files are identified by letters, "a" being the first. Ranks are labelled by numbers, starting at "1".
# The square "a1" is in the lower-left hand side of the board.
#
# It's possible to exclude certain regions of the board. Moves are never generated from or to these squares:
#  Exclude: g1,h1,g2,h2,g3,h3,g4,h4,g5,h5,g6,h6,a7,b7,c7,d7,e7,f7,g7,h7,a8,b8,c8,d8,e8,f8,g8,h8
# excludes the last two rows and the rightmost files on the board, effectively reducing the board to 6x6.
# This feature is experimental and may not always work correctly.
#
# For some games, the victory (or drawing!) condition can be to occupy a specific region of the board.
# This is referred to here as "capture the flag". To enable this, a special zone has to be defined for each
# player, WhiteFlag for white and BlackFlag for black:
#  WhiteFlag: e1
#  BlackFlag: e8
# The game ends when white captures and holds all black flags and vice versa.

# MOVEMENT TYPES
#
# In order to define new variants, it is important to know how to specify the movement of the pieces.
# Sjaak distinguishes three types of moves:
#
# Sliders  - move along a ray direction until they encounter another piece or the edge of the board
# Leapers  - perform single steps to specified target squares
# Steppers - perform single (repeated) steps in a particular board direction
#
# Each of these moves treats the board in a slightly different way, and so the description of moves for each
# is different:
#
# Sliders move along a ray, either horizontal (H), vertical (V), diagonal (D) or anti-diaginal (A).
# Examples:
#  slide (H,V)         - describes a chess rook
#  slide (A,D)         - describes a bishop
#  slide (H,V,A,D)     - describes a queen
#
# Leaper moves can become complicated, but in their simplest form they just specify the step-vector, which is
# then mirrored to give a total of up to 8 target squares.
# Examples:
#  leap (2,1)          - describes a knight
#  leap (1,2)          - alternative description of a knight
#  leap (1,1)          - describes a ferz
#  leap (2,2)          - an elephant
#  leap (1,0)          - a wazir
#  leap (2,0)          - a dabbabah
# The complications begin when a piece is a compound leaper, meaning it can choose between different leaper
# moves. For instance, a king can move as a ferz, or as a wazir:
#  leap (1,0)|(1,1)    - a king
# However, a leaper can also be a two-step leaper, which first moves as one type of leaper and then again as
# another type of leaper:
#  leap (1,0)+(1,1)    - move as a wazir first and then as a ferz
# Typically, this is useful to define lame leapers by also specifying a mask:
#  leap ((1,0)+(1,1)) & (1,2)
# describes a piece that moves first as a wazir (only to empty squares) and then again as a ferz. However,
# the final destination must be a square that could have been reached by a knight. In other words, this
# describes a piece that moves like a knight, but can be blocked. A Xiangqi horse.
#
# For steppers, board directions are indicated by compass points, so "north" (the side of the board where
# black starts out), "south" (where white starts), "east" (the king-side, the direction of the H-file) and
# "west" (towards the A-file).
# Steppers are intended to be asymmetric (move different for white and black),
#  step N              - describes a piece that moves one square "north", a white pawn
#  step S              - describes a piece that moves one square "south", a black pawn
# Optionally, the direction can be prefixed with a number (1-7):
#  step 2N             - the initial double step of a white pawn.
# Steppers are normally used to define pawns, and a number of pawn-specific evaluation terms are only
# activated for pieces that are defined as stepper moves. Steppers also have their moves generated in bulk,
# one direction at a time (as opposed to one piece at a time), which impacts performance.
#
# Finally, there are two variations to the three above movement types: hoppers and asymmetric leapers.
#
# Hoppers are sliders that need to jump over another piece before they can move.
#  hop (H,V)           - describes the capture move of a cannon in Xiangqi
# Currently, capture is replacement only. It is not possible (yet) to define a piece that captures by leaping
# over its victim.
#
# Asymmetric leapers are leapers that, as the name implies, move differently for white and black.
# Their syntax is similar to that of normal leapers, but instead of specifying the movement vector, it's
# necessary to specify each step:
#  aleap (0,1)         - a piece that moves one square north for white and one square south for black (like a pawn)
#  aleap (1,1)|(1,-1)|(-1,-1)|(-1,1)|(0,1) - a Makruk elephant or silver general
#  aleap (1,1)|(-1,1)|(1,0)|(-1,0)|(0,1)|(0,-1) - a gold general

# MOVES AND CAPTURES
#
# A piece can have more than one movement type defined for it, simply by specifying them one after the other
# on separate lines:
#
#  Move: slide (H,V,A,D)
#  Move: leap (1,2)
#
# defines the move for an Amazon. The move types must be different on each line, or the result will be
# undefined.
# If a capture move is not specified, it is assumed to be the same as the normal move. To disable captures for
# a particular piece type, specify "none":
#
#  Capture: none     # Piece cannot capture

# SPECIAL MOVES (DOUBLE PUSHES)
#
# For pieces that can perform special moves, it's necessary to specify both the move and the location on the
# board where they can make the special move. This is done by defining a zone and then referencing it from the
# piece description:
#  Special: rank2, step 2N
# defines the initial double step for a white pawn.
# Special moves currently cannot be captures, and do not depend on whether the piece has moved or not. It
# is supported but largely untested for pieces that are not steppers.

# SPECIAL MOVES (CASTLING)
#
# Castling is a special move reserved for pieces with the "castle" flag, and only possible if neither the
# royal piece nor the secondary piece has moved. All squares between the king's initial and final position and
# between the secondary piece's initial and final positions have to be empty (apart from the squares
# containing the king and the secondary) and the king may not cross any attacked squares.
# To define a castling move, specify the (default) starting position of the king, the king's destination
# square and the secondary's (default) starting position. The secondary's destination square is derived from
# the king's move: if the king moves to the king-side (east side) of the board, the secondary moves to the
# left of the king. If the king moves to the queen-side (west side) of the board the secondary moves to the
# right of the king.
# Example:
#
#  Castle: white e1-g1 with h1     # Canonical king-side castling
#  Castle: white e1-c1 with a1     # Canonical queen-side castling
#
# To define FRC-style castling, simply define the "standard" castling rule (which provide the destination
# square for the king and the default location of the rook). The FRC rule will be based on this
# and the actual specified position of the king and rook in the startup FEN.
# Behaviour is undefined if all squares are not on one rank.

# PROMOTIONS
#
# Pieces promote as soon as they reach their promotion zone, to one of the possible promotion choices:
#  Promotion: rank8, "QRBN"
# defines the promotion for a white pawn.

# EXTRA RULES AND VICTORY CONDITIONS
#
# It's possible to specify a number of extra rule options or game-ending conditions.
# End-of-game scores can be any of "win", "loss", "draw" or "illegal".
# Examples (these are the defaults):
#  Rule: checkmate = win
#  Rule: stalemate = draw
#  Rule: repeat3 = draw
# It's also possible to set
#  Rule: loneking = loss
# Or, for variants with no royal pieces:
#  Rule: nopieces = loss
# Another possibility is a condition for "capture the flag":
#  Rule: captureanyflag = win
#  Rule: captureallflags = win

# PIECE VISUALISATION (XBOARD/WINBOARD)
#
# You can specify the piece graphic that is used by XBoard/WinBoard to represent the pieces in your variant.
# XBoard uses a string of 44 (2x22) characters in length. To use the N-th image you simply have to replace the
# N-th character in the string with the symbol you assigned to the piece. The first 22 characters are for
# white, the last 22 are for black.
# The default value of the string is "PNBRQFEACWMOHIJGDVLSUKpnbrqfeacwmohijgdvlsuk", where the characters
# represent the following pieces:
#  P=Pawn
#  N=Knight
#  B=Bishop
#  R=Rook
#  Q=Queen
#  F=Ferz
#  E=Alfil
#  A=Archbishop
#  C=Chancellor
#  W=Wazir
#  M=Man
#  O=Cannon
#  H=Nightrider
#  I=Dragon Horse
#  J=Dragon King
#  G=Grasshopper
#  D=Alternative Chancellor image
#  V=Falcon
#  L=Lance (or Amazon/Berolina pawn)
#  S=Snake
#  U=Unicorn
#  K=King 
# If you do not use a particular bitmap, simply put "." in its place. Example:
#  XBoard pieces: "PNBRQFEACWMOHIJGDVLSUKpnbrqfeacwmohijgdvlsuk"
# When specifying the string, you can write both "XBoard" and "WinBoard".



#############################################################
# Example: duplicate the definition for standard FIDE chess #
#############################################################
Variant: FIDE Chess (8x8)                                      # Name with which the variant can be selected
Board: 8x8                                                     # Board size
FEN: "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq -"    # Startup FEN, pieces defined below
Zone: rank8 = a8,b8,c8,d8,e8,f8,g8,h8                          # Special regions on the board, used below
Zone: rank7 = a7,b7,c7,d7,e7,f7,g7,h7
Zone: rank2 = a2,b2,c2,d2,e2,f2,g2,h2
Zone: rank1 = a1,b1,c1,d1,e1,f1,g1,h1

# Define the pieces
Piece: Knight                                                  # New piece and its name
Move: leap (2,1)                                               # Movement type
Symbol: "N", "N,n"                                             # Symbol used for SAN and symbols used in FEN
Value: 320                                                     # Piece value, used by evaluation

Piece: Bishop
Move: slide (D,A)
Symbol: "B", "B,b"
Value 325

Piece: Rook
Move: slide (H,V)
Symbol: "R", "R,r"
Value: 500

Piece: Queen
Move: slide (D,A,H,V)
Symbol: "Q", "Q,q"
Value: 950

Piece: King
Move: leap(0,1)|(1,1)
Symbol: "K", "K,k"
Flags: royal, castle                                           # Piece flags: royal piece, may castle

Piece: White Pawn                                              # White pawns and black pawns are different pieces
Move: step N
Capture: step NE,NW
Special: rank2, step 2N
Symbol: " ", "P"
Flags: set_ep,take_ep                                          # Sets the EP-target square after move, captures EP
Promotion: rank8, "QRBN"                                       # Promotes when reaching the 8th rank
Value: 100

Piece: Black Pawn                                              # White pawns and black pawns are different pieces
Move: step S
Capture: step SE,SW
Special: rank7, step 2S
Symbol: " ", ",p"
Flags: set_ep,take_ep                                          # Sets the EP-target square after move, captures EP
Promotion: rank1, "QRBN"                                       # Promotes when reaching the 1st rank
Value: 100




############################################################################################
# Example: wolves and Sheep. The wolves try to corner the sheep, the sheep tries to escape #
############################################################################################
Variant: Wolves and Sheep (8x8)
Board: 8x8
FEN: "1w1w1w1w/8/8/8/8/8/8/4S3 w - -"
XBoard pieces: ".....W...S.................w...s............"
BlackFlag: a8,b8,c8,d8,e8,f8,g8,h8

Piece: Sheep
Move: leap(1,1)
Capture: none
Symbol: "S", "S,s"

Piece: Wolf
Move: aleap(1,1)|(-1,1)
Capture: none
Symbol: "W", "W,w"

Rule: captureanyflag = win
Rule: stalemate = win




#############################################################
# Example: Los Alamos Chess (faux 8x8)                      #
#############################################################
Variant: Los Alamos Chess (6x6 on 8x8)                         # Name with which the variant can be selected
Board: 8x8                                                     # Board size
FEN: "8/8/rnqknr2/pppppp2/8/8/PPPPPP2/RNQKNR2 w - -"           # Startup FEN, pieces defined below
Zone: rank6 = a6,b6,c6,d6,e6,f6,g6,h6                          # Special regions on the board, used below
Zone: rank1 = a1,b1,c1,d1,e1,f1,g1,h1
Exclude: g1,h1,g2,h2,g3,h3,g4,h4,g5,h5,g6,h6,a7,b7,c7,d7,e7,f7,g7,h7,a8,b8,c8,d8,e8,f8,g8,h8

# Define the pieces
Piece: Knight                                                  # New piece and its name
Move: leap (2,1)                                               # Movement type
Symbol: "N", "N,n"                                             # Symbol used for SAN and symbols used in FEN
Value: 320                                                     # Piece value, used by evaluation

Piece: Rook
Move: slide (H,V)
Symbol: "R", "R,r"
Value: 500

Piece: Queen
Move: slide (D,A,H,V)
Symbol: "Q", "Q,q"
Value: 950

Piece: King
Move: leap(0,1)|(1,1)
Symbol: "K", "K,k"
Flags: royal                                                   # Piece flags: royal piece, may castle

Piece: White Pawn                                              # White pawns and black pawns are different pieces
Move: step N
Capture: step NE,NW
Symbol: " ", "P"
Flags: set_ep,take_ep                                          # Sets the EP-target square after move, captures EP
Promotion: rank6, "QRN"                                        # Promotes when reaching the 8th rank
Value: 100

Piece: Black Pawn                                              # White pawns and black pawns are different pieces
Move: step S
Capture: step SE,SW
Symbol: " ", ",p"
Flags: set_ep,take_ep                                          # Sets the EP-target square after move, captures EP
Promotion: rank1, "QRN"                                        # Promotes when reaching the 1st rank
Value: 100




######################################################
# Peasant Revolt (Pritchard 2007, chessvariants.org) #
######################################################
Variant: Peasant's Revolt (8x8)
Board: 8x8
FEN: "1nn1k1n1/4p3/8/8/8/8/PPPPPPPP/4K3 w - -"
Zone: rank8 = a8,b8,c8,d8,e8,f8,g8,h8
Zone: rank1 = a1,b1,c1,d1,e1,f1,g1,h1

# Define the pieces
Piece: Knight
Move: leap (2,1)
Symbol: "N", "N,n"
Value: 250

Piece: Bishop
Move: slide (D,A)
Symbol: "B", "B,b"
Value 325

Piece: Rook
Move: slide (H,V)
Symbol: "R", "R,r"
Value: 500

Piece: Queen
Move: slide (D,A,H,V)
Symbol: "Q", "Q,q"
Value: 950

Piece: King
Move: leap(0,1)|(1,1)
Symbol: "K", "K,k"
Flags: royal

Piece: White Pawn
Move: step N
Capture: step NE,NW
Symbol: " ", "P"
Promotion: rank8, "QRBN"
Value: 100

Piece: Black Pawn
Move: step S
Capture: step SE,SW
Symbol: " ", ",p"
Promotion: rank1, "QRBN"
Value: 100




###################################
# Corridor Chess (Pritchard 2007) #
###################################
Variant: Corridor Chess (8x8)
Board: 8x8
FEN: "1nrqkrn1/2b2b2/1pppppp1/8/8/1PPPPPP1/2B2B2/1NRQKRN1 w - -"
Zone: rank8 = a8,b8,c8,d8,e8,f8,g8,h8
Zone: rank1 = a1,b1,c1,d1,e1,f1,g1,h1

# Define the pieces
Piece: Knight
Move: leap (2,1)
Symbol: "N", "N,n"
Value: 320

Piece: Bishop
Move: slide (D,A)
Symbol: "B", "B,b"
Value 325

Piece: Rook
Move: slide (H,V)
Symbol: "R", "R,r"
Value: 500

Piece: Queen
Move: slide (D,A,H,V)
Symbol: "Q", "Q,q"
Value: 950

Piece: King
Move: leap(0,1)|(1,1)
Symbol: "K", "K,k"
Flags: royal

Piece: White Pawn
Move: step N
Capture: step NE,NW
Symbol: " ", "P"
Promotion: rank8, "QRBN"
Value: 100

Piece: Black Pawn
Move: step S
Capture: step SE,SW
Symbol: " ", ",p"
Promotion: rank1, "QRBN"
Value: 100




############################################################
# Legan's chess (http://en.wikipedia.org/wiki/Legan_chess) #
############################################################
Variant: Legan's Chess (8x8)
Board: 8x8
FEN: "knbrp3/bqpp4/npp5/rp1p3P/p3P1PR/5PPN/4PPQB/3PRBNK w - -"
Zone: white_promo = a5,a6,a7,a8,b8,c8,d8
Zone: black_promo = e1,f1,g1,h1,h2,h3,h4

# Define the pieces
Piece: Knight                                                  # New piece and its name
Move: leap (2,1)                                               # Movement type
Symbol: "N", "N,n"                                             # Symbol used for SAN and symbols used in FEN
Value: 320                                                     # Piece value, used by evaluation

Piece: Bishop
Move: slide (D,A)
Symbol: "B", "B,b"
Value 325

Piece: Rook
Move: slide (H,V)
Symbol: "R", "R,r"
Value: 500

Piece: Queen
Move: slide (D,A,H,V)
Symbol: "Q", "Q,q"
Value: 950

Piece: King
Move: leap(0,1)|(1,1)
Symbol: "K", "K,k"
Flags: royal

Piece: White Pawn
Move: step NW
Capture: step N,W
Symbol: " ", "P"
Promotion: white_promo, "QRBN"
Value: 100

Piece: Black Pawn
Move: step SE
Capture: step S,E
Symbol: " ", ",p"
Promotion: black_promo, "QRBN"
Value: 100




##################################
# Diamond Chess (Pritchard 2007) #
##################################
Variant: Diamond Chess (8x8)
Board: 8x8
FEN: "krbp4/rqnp4/nbpp4/pppp4/4PPPP/4PPBN/4PNQR/4PBRK w - -"
Zone: white_promo = a1,a2,a3,a4,a5,a6,a7,a8,b8,c8,d8,e8,f8,g8,h8
Zone: black_promo = a1,b1,c1,d1,e1,f1,g1,h1,h2,h3,h4,h5,h6,h7,h8

# Define the pieces
Piece: Knight
Move: leap (2,1)
Symbol: "N", "N,n"
Value: 320

Piece: Bishop
Move: slide (D,A)
Symbol: "B", "B,b"
Value 325

Piece: Rook
Move: slide (H,V)
Symbol: "R", "R,r"
Value: 500

Piece: Queen
Move: slide (D,A,H,V)
Symbol: "Q", "Q,q"
Value: 950

Piece: King
Move: leap(0,1)|(1,1)
Symbol: "K", "K,k"
Flags: royal

Piece: White Pawn
Move: step NW
Capture: step N,W
Symbol: " ", "P"
Promotion: white_promo, "QRBN"
Value: 100

Piece: Black Pawn
Move: step SE
Capture: step S,E
Symbol: " ", ",p"
Promotion: black_promo, "QRBN"
Value: 100




###################################
# Diagonal Chess (Pritchard 2007) #
###################################
Variant: Diagonal Chess (8x8)
Board: 8x8
FEN: "4pnrk/4pbpr/4pbqn/4pppp/PPPP4/NQBP4/RPBP4/KRNP4 w - -"
Zone: white_promo = h1,h2,h3,h4,h5,h6,h7,a8,b8,c8,d8,e8,f8,g8,h8
Zone: black_promo = a1,b1,c1,d1,e1,f1,g1,h1,a2,a3,a4,a5,a6,a7,a8

# Define the pieces
Piece: Knight
Move: leap (2,1)
Symbol: "N", "N,n"
Value: 320

Piece: Bishop
Move: slide (D,A)
Symbol: "B", "B,b"
Value 325

Piece: Rook
Move: slide (H,V)
Symbol: "R", "R,r"
Value: 500

Piece: Queen
Move: slide (D,A,H,V)
Symbol: "Q", "Q,q"
Value: 950

Piece: King
Move: leap(0,1)|(1,1)
Symbol: "K", "K,k"
Flags: royal

Piece: White Pawn
Move: step NE
Capture: step N,E
Symbol: " ", "P"
Promotion: white_promo, "QRBN"
Value: 100

Piece: Black Pawn
Move: step SW
Capture: step S,W
Symbol: " ", ",p"
Promotion: black_promo, "QRBN"
Value: 100




#################################
# Corner Chess (Pritchard 2007) #
#################################
Variant: Corner Chess (8x8)
Board: 8x8
FEN: "kbp2pbq/nrp2prn/pp4pp/8/8/PP4PP/NRP2PRN/QBP2PBK w - -"
Zone: white_promo = a8,b8,c8,d8,e8,f8,g8,h8
Zone: black_promo = a1,b1,c1,d1,e1,f1,g1,h1

# Define the pieces
Piece: Knight
Move: leap (2,1)
Symbol: "N", "N,n"
Value: 320

Piece: Bishop
Move: slide (D,A)
Symbol: "B", "B,b"
Value 325

Piece: Rook
Move: slide (H,V)
Symbol: "R", "R,r"
Value: 500

Piece: Queen
Move: slide (D,A,H,V)
Symbol: "Q", "Q,q"
Value: 950

Piece: King
Move: leap(0,1)|(1,1)
Symbol: "K", "K,k"
Flags: royal

Piece: White Pawn
Move: step NE,NW
Capture: step N
Symbol: " ", "P"
Promotion: white_promo, "QRBN"
Value: 100

Piece: Black Pawn
Move: step SW,SE
Capture: step S
Symbol: " ", ",p"
Promotion: black_promo, "QRBN"
Value: 100




#########################################
# A variant with a Chancellor and Queen #
#########################################
Variant: Chancellor Chess (9x9)
Board: 9x9
FEN: "rnbqkcnbr/ppppppppp/9/9/9/9/9/PPPPPPPPP/RNBQKCNBR w KQkq -"
Zone: rank9 = a9,b9,c9,d9,e9,f9,g9,h9,i9
Zone: rank8 = a8,b8,c8,d8,e8,f8,g8,h8,i8
Zone: rank2 = a2,b2,c2,d2,e2,f2,g2,h2,i2
Zone: rank1 = a1,b1,c1,d1,e1,f1,g1,h1,i1

# Define the pieces
Piece: Knight
Move: leap (2,1)
Symbol: "N", "N,n"
Value: 320

Piece: Bishop
Move: slide (D,A)
Symbol: "B", "B,b"
Value 325

Piece: Rook
Move: slide (H,V)
Symbol: "R", "R,r"
Value: 500

Piece: Queen
Move: slide (D,A,H,V)
Symbol: "Q", "Q,q"
Value: 950

Piece: Chancellor
Move: slide (H,V)
Move: leap (2,1)
Symbol: "C", "C,c"
Value: 875

Piece: King
Move: leap(0,1)|(1,1)
Symbol: "K", "K,k"
Flags: royal, castle
Castle: white e1-g1 with i1
Castle: white e1-c1 with a1
Castle: black e9-g9 with i9
Castle: black e9-c9 with a9

Piece: White Pawn
Move: step N
Capture: step NE,NW
Special: rank2, step 2N
Symbol: " ", "P"
Flags: set_ep,take_ep
Promotion: rank9, "QCRBN"
Value: 100

Piece: Black Pawn
Move: step S
Capture: step SE,SW
Special: rank8, step 2S
Symbol: " ", ",p"
Flags: set_ep,take_ep
Promotion: rank1, "QCRBN"
Value: 100




###################################################
# A variant where a Chancellor replaces the Queen #
###################################################
Variant: Chancellor Chess (8x8)                                # Name with which the variant can be selected
Board: 8x8                                                     # Board size
FEN: "rnbckbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBCKBNR w KQkq -"    # Startup FEN, pieces defined below
Zone: rank8 = a8,b8,c8,d8,e8,f8,g8,h8                          # Special regions on the board, used below
Zone: rank7 = a7,b7,c7,d7,e7,f7,g7,h7
Zone: rank2 = a2,b2,c2,d2,e2,f2,g2,h2
Zone: rank1 = a1,b1,c1,d1,e1,f1,g1,h1

# Define the pieces
Piece: Knight                                                  # New piece and its name
Move: leap (2,1)                                               # Movement type
Symbol: "N", "N,n"                                             # Symbol used for SAN and symbols used in FEN
Value: 320                                                     # Piece value, used by evaluation

Piece: Bishop
Move: slide (D,A)
Symbol: "B", "B,b"
Value 325

Piece: Rook
Move: slide (H,V)
Symbol: "R", "R,r"
Value: 500

Piece: Chancellor
Move: slide (H,V)
Move: leap (2,1)
Symbol: "C", "C,c"
Value: 875

Piece: King
Move: leap(0,1)|(1,1)
Symbol: "K", "K,k"
Flags: royal, castle                                           # Piece flags: royal piece, may castle

Piece: White Pawn                                              # White pawns and black pawns are different pieces
Move: step N
Capture: step NE,NW
Special: rank2, step 2N
Symbol: " ", "P"
Flags: set_ep,take_ep                                          # Sets the EP-target square after move, captures EP
Promotion: rank8, "CRBN"                                       # Promotes when reaching the 8th rank
Value: 100

Piece: Black Pawn                                              # White pawns and black pawns are different pieces
Move: step S
Capture: step SE,SW
Special: rank7, step 2S
Symbol: " ", ",p"
Flags: set_ep,take_ep                                          # Sets the EP-target square after move, captures EP
Promotion: rank1, "CRBN"                                       # Promotes when reaching the 1st rank
Value: 100




############################################################################
# A variant of Shatranj with dabbabah's, supposedly from 9th century India #
############################################################################
Variant: Ninth Century Indian Chess (8x8)
Board: 8x8
FEN: "dnrkfrnd/pppppppp/8/8/8/8/PPPPPPPP/DNRKFRND w - -"
XBoard pieces: "PN.R.F........D......Kpn.r.f........d......k"     # Use the "crowned rook" for the dabbabah
Zone: rank8 = a8,b8,c8,d8,e8,f8,g8,h8
Zone: rank1 = a1,b1,c1,d1,e1,f1,g1,h1

# Define the pieces
Piece: Knight
Move: leap (2,1)
Symbol: "N", "N,n"
Value: 320

Piece: Dabbabah
Move: leap (2,0)
Symbol: "D", "D,d"
Value 200

Piece: Rook
Move: slide (H,V)
Symbol: "R", "R,r"
Value: 500

Piece: Ferz
Move: leap (1,1)
Symbol: "F", "F,f"
Value: 150

Piece: King
Move: leap(0,1)|(1,1)
Symbol: "K", "K,k"
Flags: royal

Piece: White Pawn
Move: step N
Capture: step NE,NW
Symbol: " ", "P"
Promotion: rank8, "F"
Value: 100

Piece: Black Pawn
Move: step S
Capture: step SE,SW
Symbol: " ", ",p"
Promotion: rank1, "F"
Value: 100

Rule: stalemate = win      # The stale-mated player wins (!)
Rule: loneking = loss




############################################
# A game where sliders captures as hoppers #
############################################
Variant: Cannon Chess (8x8)
Board: 8x8
FEN: "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq -"
XBoard pieces: "PN.........R.B.Q.....Kpn.........r.b.q.....k"
Zone: rank8 = a8,b8,c8,d8,e8,f8,g8,h8
Zone: rank7 = a7,b7,c7,d7,e7,f7,g7,h7
Zone: rank2 = a2,b2,c2,d2,e2,f2,g2,h2
Zone: rank1 = a1,b1,c1,d1,e1,f1,g1,h1

# Define the pieces
Piece: Knight
Move: leap (2,1)
Symbol: "N", "N,n"
Value: 450

Piece: Bishop
Move: slide (D,A)
Capture: hop (D,A)
Symbol: "B", "B,b"
Value 350

Piece: Rook
Move: slide (H,V)
Capture: hop (H,V)
Symbol: "R", "R,r"
Value: 400

Piece: Queen
Move: slide (D,A,H,V)
Capture: hop (D,A,H,V)
Symbol: "Q", "Q,q"
Value: 600

Piece: King
Move: leap(0,1)|(1,1)
Symbol: "K", "K,k"
Flags: royal, castle

Piece: White Pawn
Move: step N
Capture: step NE,NW
Special: rank2, step 2N
Symbol: " ", "P"
Flags: set_ep,take_ep
Promotion: rank8, "QRBN"
Value: 100

Piece: Black Pawn
Move: step S
Capture: step SE,SW
Special: rank7, step 2S
Symbol: " ", ",p"
Flags: set_ep,take_ep
Promotion: rank1, "QRBN"
Value: 100








########################################
# A game where sliders move as hoppers #
########################################
Variant: Inverse Cannon Chess (8x8)
Board: 8x8
FEN: "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq -"
XBoard pieces: "PN.........R.B.Q.....Kpn.........r.b.q.....k"
Zone: rank8 = a8,b8,c8,d8,e8,f8,g8,h8
Zone: rank7 = a7,b7,c7,d7,e7,f7,g7,h7
Zone: rank2 = a2,b2,c2,d2,e2,f2,g2,h2
Zone: rank1 = a1,b1,c1,d1,e1,f1,g1,h1

# Define the pieces
Piece: Knight
Move: leap (2,1)
Symbol: "N", "N,n"
Value: 450

Piece: Bishop
Move: hop (D,A)
Capture: slide (D,A)
Symbol: "B", "B,b"
Value 350

Piece: Rook
Move: hop (H,V)
Capture: slide (H,V)
Symbol: "R", "R,r"
Value: 400

Piece: Queen
Move: hop (D,A,H,V)
Capture: slide (D,A,H,V)
Symbol: "Q", "Q,q"
Value: 600

Piece: King
Move: leap(0,1)|(1,1)
Symbol: "K", "K,k"
Flags: royal, castle

Piece: White Pawn
Move: step N
Capture: step NE,NW
Special: rank2, step 2N
Symbol: " ", "P"
Flags: set_ep,take_ep
Promotion: rank8, "QRBN"
Value: 100

Piece: Black Pawn
Move: step S
Capture: step SE,SW
Special: rank7, step 2S
Symbol: " ", ",p"
Flags: set_ep,take_ep
Promotion: rank1, "QRBN"
Value: 100



###########################################################################
# Troitzky chess                                                          #
# http://www.chessvariants.org/index/msdisplay.php?itemid=MPtroitzkychess #
###########################################################################
Variant: Troitzky Chess (10x10)
Board: 10x10
FEN: "4qk4/2rnbbnr2/1pppppppp1/10/10/10/10/1PPPPPPPP1/2RNBBNR2/4QK4 w KQkq -"
Zone: white_promotion = a6,b8,c9,d9,e10,f10,g9,h9,i8,j6
Zone: black_promotion = a5,b3,c2,d2,e1,f1,g2,h2,i3,j5
Zone: rank8 = b8,c8,d8,e8,f8,g8,h8,i8
Zone: rank3 = b3,c3,d3,e3,f3,g3,h3,i3
Exclude: a1,b1,c1,d1,g1,h1,i1,j1,a2,b2,i2,j2,a3,j3,a4,j4
Exclude: a10,b10,c10,d10,g10,h10,i10,j10,a9,b9,i9,j9,a8,j8,a7,j7

Piece: Knight
Move: leap (2,1)
Symbol: "N", "N,n"
Value: 320

Piece: Bishop
Move: slide (D,A)
Symbol: "B", "B,b"
Value 325

Piece: Rook
Move: slide (H,V)
Symbol: "R", "R,r"
Value: 500

Piece: Queen
Move: slide (D,A,H,V)
Symbol: "Q", "Q,q"
Value: 950

Piece: King
Move: leap(0,1)|(1,1)
Symbol: "K", "K,k"
Flags: royal

Piece: White Pawn
Move: step N
Capture: step NE,NW
Special: rank3, step 2N
Symbol: " ", "P"
Promotion: white_promotion, "QRBN"
Value: 100

Piece: Black Pawn
Move: step S
Capture: step SE,SW
Special: rank8, step 2S
Symbol: " ", ",p"
Promotion: black_promotion, "QRBN"
Value: 100



