; *** Double-Ended Chess ; *** Based on Zillions Chess ZRF, Rev 1.2 ; *** Which is Copyright 1998-2000 Zillions Development ; *** Game and ZRF by Peter Aronson. ; You need to purchase Zillions of Games to load this rules file ; Visit the Zillions web site at http://www.zillions-of-games.com ;; Add macros (define generic-add add) (define special-add (set-attribute never-moved? false) add) (define Pawn-add (if (in-zone? promotion-zone) (add Knight Bishop Rook Queen) else add) ) ;; Piece movement macros. ; Knight's and Mirror-Knight's move. ; $1 = 1st direction, this is the direction for withdrawal captures. ; $2 = 2nd direction, this is the direction for approach captures. (define leap2 ( (set-flag withdraw-target? false) (if (on-board? (opposite $1)) (opposite $1) (set-flag withdraw-target? enemy?) (if (flag? withdraw-target?) mark) ) (go from) $1 $2 (verify empty?) (if (flag? withdraw-target?) back capture (go from) $1 $2 ) (if (enemy? $2) mark $2 capture back ) add )) ; Long-capturing Knight's move, with captures occuring a knight's move ahead and behind. ; $1 = 1st (othorgonal) direction ; $2 = 2nd (diagonal) direction. (define long-capturing-leap2 ( (set-flag withdraw-target? false) (if (on-board? (opposite $1)) (opposite $1) (if (on-board? (opposite $2)) (opposite $2) (set-flag withdraw-target? enemy?) (if (flag? withdraw-target?) mark) ) ) (go from) $1 $2 (verify empty?) (if (flag? withdraw-target?) back capture (go from) $1 $2 ) (if (on-board? $1) mark $1 (if (enemy? $2) $2 capture ) back ) add )) ; King's move -- marks that the King can no longer castle. ; $1 = Direction of move. (define king-shift ( (set-flag withdraw-target? false) (if (on-board? (opposite $1)) (opposite $1) (set-flag withdraw-target? enemy?) (if (flag? withdraw-target?) mark) (go from) ) $1 (verify empty?) (if (flag? withdraw-target?) back capture (go from) $1 ) (if (enemy? $1) mark $1 capture back ) (special-add) )) ; Rook, Bishop and Queen's move. ; $1 = Direction of slide. ; $2 = Type of add to use, generic or special (define slide-move (set-flag withdraw-target? false) (if (on-board? (opposite $1)) (opposite $1) (set-flag withdraw-target? enemy?) (go from) ) $1 (verify empty?) (while empty? (if (flag? withdraw-target?) mark (go from) (opposite $1) capture back ) (if (enemy? $1) $1 capture (opposite $1) ) ($2-add) $1 ) ) ; Bishop and Queen move ; $1 = Direction of move. (define slide ( (slide-move $1 generic) )) ; Rook move ; $1 = Direction of move. (define rook-slide ( (slide-move $1 special) )) ; Castle King-side (define O-O ( (verify never-moved?) e ; KB1 (verify empty?) e ; KN1 (verify empty?) cascade e ; KR1 (verify (and friend? (piece? Rook) never-moved?) ) from back ; K1 ; Save expensive not-attacked?s for last (verify not-attacked?) e ; KB1 (verify not-attacked?) to (set-attribute never-moved? false) ; We could check if KN1 is attacked too, but this isn't ; really necessary since Zillions doesn't allow any moves ; into check e ; KN1 (set-attribute never-moved? false) add ) ) ; Castle Queen-side (define O-O-O ( (verify never-moved?) w ; Q1 (verify empty?) w ; QB1 (verify empty?) cascade w ; QN1 (verify empty?) w ; QR1 (verify (and friend? (piece? Rook) never-moved?) ) from back ; K1 ; Save expensive not-attacked?s for last (verify not-attacked?) w ; Q1 (verify not-attacked?) to (set-attribute never-moved? false) ; We could check if KN1 is attacked too, but this isn't ; really necessary since Zillions doesn't allow any moves ; into check w ; QB1 (set-attribute never-moved? false) add ) ) ; Non-capturing pawn forward move, with double initial move. (define Pawn-move ( n (verify empty?) (Pawn-add) (verify (in-zone? third-rank)) n (verify empty?) add ) ) ; Pawn diagonal forward capture, can only be made if there is a capture. ; $1 = Direction to capture (must be ne or nw). (define Pawn-capture ( (set-flag withdraw-target? false) (if (on-board? (opposite $1)) (opposite $1) (set-flag withdraw-target? enemy?) (if (flag? withdraw-target?) mark) (go from) ) $1 (verify empty?) (if (flag? withdraw-target?) back capture (go from) $1 ) mark $1 (if enemy? capture else (verify (flag? withdraw-target?)) ; There has to be some sort of capture. ) back add )) (define Board-Definitions (image "images\Chess\Chess8x8.bmp") (grid (start-rectangle 5 5 53 53) (dimensions ("a/b/c/d/e/f/g/h" (49 0)) ; files ("8/7/6/5/4/3/2/1" (0 49)) ; ranks ) (directions (n 0 -1) (e 1 0) (s 0 1) (w -1 0) (ne 1 -1) (nw -1 -1) (se 1 1) (sw -1 1) ) ) (symmetry Black (n s)(s n) (nw sw)(sw nw) (ne se)(se ne)) (zone (name promotion-zone) (players White) (positions a8 b8 c8 d8 e8 f8 g8 h8) ) (zone (name promotion-zone) (players Black) (positions a1 b1 c1 d1 e1 f1 g1 h1) ) (zone (name third-rank) (players White) (positions a3 b3 c3 d3 e3 f3 g3 h3) ) (zone (name third-rank) (players Black) (positions a6 b6 c6 d6 e6 f6 g6 h6) ) ) (game (title "Double-Ended Chess") (description "Double-Ended Chess is a variant of Chess where captures are by withdrawal and approach, as in the Malagasy game of Fanorona. However, unlike in Fanorona, individual pieces are captured, not lines, and captures can be made both by withdrawal and approach in the same move.\\ Rules are identical to International (FIDE) Chess, except in the manner of capturing. Also, the Queen's Knight is replaced by a Mirror-Knight (see below for description).\\ Capture by withdrawal occurs when a piece is adjacent to an opposing piece, and moves away from it in the same line.\\ Capture by approach occurs when a piece is moved next to an opposing piece in the same line as the movement.\\ While moving to capture is not obligatory (except as under the normal rules of International Chess, such as relieving check), when moving in Double-Ended Chess, any captures by approach or withdrawal occur automatically; if you withdraw from, or approach an opposing piece, capture occurs.\\ Knights are considered to move a single square orthogonally, possibly jumping over a friendly or opposing piece, then a single square diagonally outward (the withdrawal capture occurs in the orthogonal direction, the approach capture in the diagonal direction). Mirror-Knights move like Knights, but in the opposite order: a diagonal move followed by an orthogonal move outward (the withdrawal capture occurs in the diagonal direction and the approach capture in the orthogonal direction).\\ Pawns may move diagonally only to capture, but such captures can be by approach or by withdrawal, so a pawn can either capture a piece that is two squares diagonally ahead of it, or immediately diagonally behind. There is no special en-passant capture.\\ The King does not capture by withdrawal during castling, even if there is an opposing piece adjacent to it.") (history "Doubled-Ended Chess was inspired by the unique methods of capture used in the Malagasy board game of Fanorona. In particular, it was inspired by a saying:\\ `It is unfair to bite at both ends simultaneously like a leech.`\\ Which explains why in Fanorona, captures must be either by approach or by withdrawl, but not both, unlike in this game, which does allow `biting at at both ends simultaneously`. The original name for this game was, in fact, Leech Chess, although that was eventually rejected as being too unpleasant.\\ Game designed by Peter Aronson, December 2000.") (strategy "Obscure. Knights and Pawns have greater range than in International Chess. There are a lot of possibilities for attack, and attack seems relatively stronger than defense than in International Chess.") (win-sound "Audio\Orchestra_CF.wav") (loss-sound "Audio\Orchestra_FC.wav") (click-sound "Audio\Pickup.wav") (release-sound "Audio\WoodThunk.wav") (players White Black) (turn-order White Black) (pass-turn false) (board (Board-Definitions)) (board-setup (White (Pawn a2 b2 c2 d2 e2 f2 g2 h2) (Knight g1) (Mirror-Knight b1) (Bishop c1 f1) (Rook a1 h1) (Queen d1) (King e1) ) (Black (Pawn a7 b7 c7 d7 e7 f7 g7 h7) (Knight g8) (Mirror-Knight b8) (Bishop c8 f8) (Rook a8 h8) (Queen d8) (King e8) ) ) (piece (name Pawn) (help "Pawn: moves forward, captures diagonally, can promote on 8th row") (description "Pawn\A Pawn can move straight ahead one square, or two squares from its starting position. A Pawn captures by moving diagonally forward one square; and can only mvoe diagonally if it results in a capture. If a Pawn reaches the far rank it promotes, changing into a Knight, Bishop, Rook, or Queen.") (image White "images\Chess\wpawn.bmp" Black "images\Chess\bpawn.bmp") (moves (Pawn-capture nw) (Pawn-capture ne) (Pawn-move) ) ) (piece (name Knight) (help "Knight: moves 1 square orthogonally, then 1 square diagonally out") (description "Knight\A Knight moves one square orthogonally, then one square diagonally outward. It hops over any pieces on the way.") (image White "images\Chess\wknight.bmp" Black "images\Chess\bknight.bmp") (moves (leap2 n ne) (leap2 n nw) (leap2 s se) (leap2 s sw) (leap2 e ne) (leap2 e se) (leap2 w nw) (leap2 w sw) ) ) (piece (name Mirror-Knight) (help "Mirror-Knight: Moves 1 sqaure diagonally, then 1 square orthogonally out") (description "Mirror-Knight\A Mirror-Knight moves one diagonally, then one square orthogonally outward. It hops over any pieces on the way.") (image White "images\Chess\wdownknight.bmp" Black "images\Chess\bdownknight.bmp") (moves (leap2 ne n) (leap2 nw n) (leap2 se s) (leap2 sw s) (leap2 ne e) (leap2 se e) (leap2 nw w) (leap2 sw w) ) ) (piece (name Bishop) (help "Bishop: slides diagonally any number of squares") (description "Bishop\A Bishop moves any number of squares on a diagonal. It may not leap over other pieces.") (image White "images\Chess\wbishop.bmp" Black "images\Chess\bbishop.bmp") (moves (slide ne) (slide nw) (slide se) (slide sw) ) ) (piece (name Rook) (help "Rook: slides any number of squares along the row or column.") (description "Rook\A Rook moves any number of squares orthogonally on a rank or a file. It may not leap over other pieces.") (image White "images\Chess\wrook.bmp" Black "images\Chess\brook.bmp") (attribute never-moved? true) ; Used to determine if the Rook can still castle. (moves (rook-slide n) (rook-slide e) (rook-slide s) (rook-slide w) ) ) (piece (name Queen) (help "Queen: can slide any number of squares in any direction") (description "Queen\A Queen moves any number of squares in a straight line. It may not leap over other pieces.") (image White "images\Chess\wqueen.bmp" Black "images\Chess\bqueen.bmp") (moves (slide n) (slide e) (slide s) (slide w) (slide ne) (slide nw) (slide se) (slide sw) ) ) (piece (name King) (help "King: steps 1 square in any direction to a safe square") (description "King\A King can move to any adjacent square, but never to a square where it can be captured. It may also `castle` with the Rook if neither the Rook nor King has moved yet and there is nothing in between them. In castling the King moves two squares nearer the Rook and the Rook leaps to the far side of the King. You may not castle out of or through check, or if the King or Rook involved has previously moved.") (image White "images\Chess\wking.bmp" Black "images\Chess\bking.bmp") (attribute never-moved? true) ; Used to determine if the King can still castle. (moves (king-shift n) (king-shift e) (king-shift s) (king-shift w) (king-shift ne) (king-shift nw) (king-shift se) (king-shift sw) (O-O) (O-O-O) ) ) (loss-condition (White Black) (checkmated King) ) ) (variant (title "Double-Ended Chess with Long-Capturing Knights") (description "Like regular Double-Ended Chess, except Knights capture as if the Knight's move is a single, automic move. So, the capture by withdrawal occurs an opposite Knight's move behind where the Knight started, and the capture by approach occurs a duplicated Knight's move ahead of where Knight ended up.") (board-setup (White (Pawn a2 b2 c2 d2 e2 f2 g2 h2) (Knight b1 g1) (Bishop c1 f1) (Rook a1 h1) (Queen d1) (King e1) ) (Black (Pawn a7 b7 c7 d7 e7 f7 g7 h7) (Knight b8 g8) (Bishop c8 f8) (Rook a8 h8) (Queen d8) (King e8) ) ) (piece (name Knight) (help "Knight: moves like an `L`, 2 squares one way and one the other") (description "Knight\A Knight moves like an `L`, two squares vertically plus one horizontally, or two squares horizontally plus one vertically. It hops over any pieces on the way.") (image White "images\Chess\wknight.bmp" Black "images\Chess\bknight.bmp") (moves (long-capturing-leap2 n ne) (long-capturing-leap2 n nw) (long-capturing-leap2 s se) (long-capturing-leap2 s sw) (long-capturing-leap2 e ne) (long-capturing-leap2 e se) (long-capturing-leap2 w nw) (long-capturing-leap2 w sw) ) ) )