; Switching Chess by Tony Quintanilla, July 2004, based on: ; *** Chess ; *** Copyright 1998-2002 Zillions Development ; v.2.0 ; You need to purchase Zillions of Games to load this rules file ; Visit the Zillions web site at http://www.zillions-of-games.com (version "2.0") (define leap1 ($1 (verify not-friend?) add) ) (define leap2 ($1 $2 (verify not-friend?) add) ) (define king-shift ($1 (verify not-friend?) (set-attribute never-moved? false) add) ) (define slide ($1 (while empty? add $1) (verify not-friend?) add)) (define rook-slide ( $1 (while empty? (set-attribute never-moved? false) add $1) (verify not-friend?) (set-attribute never-moved? false) add )) (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 ) ) (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 ) ) (define Pawn-add (if (in-zone? promotion-zone) (add Knight Bishop Rook Queen) else add) ) (define Pawn-move ( n (verify empty?) (Pawn-add) (verify (in-zone? third-rank)) n (verify empty?) add ) ) (define Pawn-capture ( $1 (verify enemy?) (Pawn-add) ) ) (define En-Passant ( $1 (verify enemy?) (verify last-to?) (verify (piece? Pawn)) capture n to n (verify last-from?) add ) ) ;***SPECIAL SWAP MOVE DEFINITIONS**** ;This are the swap macros for all pieces except Pawns (define swap-move ($1 (set-flag is-Pawn? (piece? Pawn)) (verify friend?) cascade back (if (and (flag? is-Pawn?) (in-zone? promotion-zone)) (add Queen Rook Bishop Knight) else add) )) (define swap (swap-move n) (swap-move ne) (swap-move e) (swap-move se) (swap-move s) (swap-move sw) (swap-move w) (swap-move nw) ) ;These are the swap moves for Knights. (define n-swap-move ($1 (set-flag is-Pawn? (piece? Pawn)) (verify friend?) (verify (not (piece? Knight))) cascade back (if (and (flag? is-Pawn?) (in-zone? promotion-zone)) (add Queen Rook Bishop Knight) else add) )) (define n-swap (n-swap-move n) (n-swap-move ne) (n-swap-move e) (n-swap-move se) (n-swap-move s) (n-swap-move sw) (n-swap-move w) (n-swap-move nw) ) ;These are the swap moves for Bishops. (define b-swap-move ($1 (set-flag is-Pawn? (piece? Pawn)) (verify friend?) (verify (not (piece? Bishop))) cascade back (if (and (flag? is-Pawn?) (in-zone? promotion-zone)) (add Queen Rook Bishop Knight) else add) )) (define b-swap (b-swap-move n) (b-swap-move ne) (b-swap-move e) (b-swap-move se) (b-swap-move s) (b-swap-move sw) (b-swap-move w) (b-swap-move nw) ) ;These are the swap moves for Rooks. (define r-swap-move ($1 (set-flag is-Pawn? (piece? Pawn)) (verify friend?) (verify (not (piece? Rook))) cascade back (if (and (flag? is-Pawn?) (in-zone? promotion-zone)) (add Queen Rook Bishop Knight) else add) )) (define r-swap (r-swap-move n) (r-swap-move ne) (r-swap-move e) (r-swap-move se) (r-swap-move s) (r-swap-move sw) (r-swap-move w) (r-swap-move nw) ) ;These are the swap moves for Queen. (define q-swap-move ($1 (set-flag is-Pawn? (piece? Pawn)) (verify friend?) (verify (not (piece? Queen))) cascade back (if (and (flag? is-Pawn?) (in-zone? promotion-zone)) (add Queen Rook Bishop Knight) else add) )) (define q-swap (q-swap-move n) (q-swap-move ne) (q-swap-move e) (q-swap-move se) (q-swap-move s) (q-swap-move sw) (q-swap-move w) (q-swap-move nw) ) ;These are the swap macros for Pawns. A separate set are required for each of the promotion possibilities. (define swap-move-q ($1 (verify friend?) (verify (not (piece? Pawn))) (if (in-zone? promotion-zone) (change-type Queen) ) cascade back add )) (define swap-q (swap-move-q n) (swap-move-q ne) (swap-move-q e) (swap-move-q se) (swap-move-q s) (swap-move-q sw) (swap-move-q w) (swap-move-q nw) ) (define swap-move-r ($1 (verify friend?) (verify (not (piece? Pawn))) (if (in-zone? promotion-zone) (change-type Rook) ) cascade back add )) (define swap-r (swap-move-r n) (swap-move-r ne) (swap-move-r e) (swap-move-r se) (swap-move-r s) (swap-move-r sw) (swap-move-r w) (swap-move-r nw) ) (define swap-move-b ($1 (verify friend?) (verify (not (piece? Pawn))) (if (in-zone? promotion-zone) (change-type Bishop) ) cascade back add )) (define swap-b (swap-move-b n) (swap-move-b ne) (swap-move-b e) (swap-move-b se) (swap-move-b s) (swap-move-b sw) (swap-move-b w) (swap-move-b nw) ) (define swap-move-k ($1 (verify friend?) (verify (not (piece? Pawn))) (if (in-zone? promotion-zone) (change-type Knight) ) cascade back add )) (define swap-k (swap-move-k n) (swap-move-k ne) (swap-move-k e) (swap-move-k se) (swap-move-k s) (swap-move-k sw) (swap-move-k w) (swap-move-k nw) ) (define Board-Definitions (image "images\Chess\SHaag\Chess8x8.bmp" "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 a2 b2 c2 d2 e2 f2 g2 h2 a3 b3 c3 d3 e3 f3 g3 h3) ) (zone (name third-rank) (players Black) (positions a6 b6 c6 d6 e6 f6 g6 h6 a7 b7 c7 d7 e7 f7 g7 h7) ) ) (game (title "Swithching Chess") (description "Object: Checkmate the opponent's King by attacking it so it cannot escape. All the normal rules of Chess apply with the following exception: in addition to their normal moves, each piece has the added ability to switch places with an adjacent friendly piece. Pieces may not switch with like pieces. \\To see a description of how a piece moves right-click on it to bring up its properties dialog.") (history "Switching Chess invented by Tony Quintanilla, July 2004.\\See: http://www.chessvariants.com/diffmove.dir/switching.html") (strategy "To be developed.") (option "prevent flipping" 2) (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) (board (Board-Definitions)) (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 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 either the first or second ranks, even if the Pawn is returned to the first or second rank as a result of a switch. In addition to its normal capabilities, this piece now may also switch places with an adjacent friendly piece, except other Pawns. \\A Pawn captures by moving one square ahead and diagonally. On rare occasions Pawns can also execute a move called `En Passant`, or `in passing`. This allows a Pawn to take an enemy Pawn that has just moved two squares. \\If a Pawn reaches the far rank it promotes, changing into a Knight, Bishop, Rook, or Queen. It can also promote as a result of a switch. ") (image White "images\Chess\SHaag\wpawn.bmp" "images\Chess\wpawn.bmp" Black "images\Chess\SHaag\bpawn.bmp" "images\Chess\bpawn.bmp") (moves (Pawn-capture nw) (Pawn-capture ne) (Pawn-move) (En-Passant e) (En-Passant w) (swap-q) (swap-r) (swap-b) (swap-k) ) ) (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. In addition to its normal capabilities, this piece now may also switch places with an adjacent friendly piece, except other Knights.") (image White "images\Chess\SHaag\wknight.bmp" "images\Chess\wknight.bmp" Black "images\Chess\SHaag\bknight.bmp" "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) (n-swap) ) ) (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. In addition to its normal capabilities, this piece now may also switch places with an adjacent friendly piece, except other Bishops.") (image White "images\Chess\SHaag\wbishop.bmp" "images\Chess\wbishop.bmp" Black "images\Chess\SHaag\bbishop.bmp" "images\Chess\bbishop.bmp") (moves (slide ne) (slide nw) (slide se) (slide sw) (b-swap) ) ) (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. In addition to its normal capabilities, this piece now may also switch places with an adjacent friendly piece, except other Rooks.") (image White "images\Chess\SHaag\wrook.bmp" "images\Chess\wrook.bmp" Black "images\Chess\SHaag\brook.bmp" "images\Chess\brook.bmp") (attribute never-moved? true) (moves (rook-slide n) (rook-slide e) (rook-slide s) (rook-slide w) (r-swap) ) ) (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. In addition to its normal capabilities, this piece now may also switch places with an adjacent friendly piece, except other Queens.") (image White "images\Chess\SHaag\wqueen.bmp" "images\Chess\wqueen.bmp" Black "images\Chess\SHaag\bqueen.bmp" "images\Chess\bqueen.bmp") (moves (slide n) (slide e) (slide s) (slide w) (slide ne) (slide nw) (slide se) (slide sw) (q-swap) ) ) (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. In addition to its normal capabilities, this piece now may also switch places with an adjacent friendly piece, except other Kings.") (image White "images\Chess\SHaag\wking.bmp" "images\Chess\wking.bmp" Black "images\Chess\SHaag\bking.bmp" "images\Chess\bking.bmp") (attribute never-moved? true) (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) (swap) ) ) (loss-condition (White Black) (checkmated King) ) ) ; ************************************************************************** (variant (title "Empty Board") (board-setup (White ;(Pawn a2 b2 c2 d2 e2 f2 g2 h2) ;(Knight d1 f1) ;(Bishop e1 h1) ;(Rook a1 b1) ;(Queen c1) (King e1) ) (Black ;(Pawn a7 b7 c7 d7 e7 f7 g7 h7) ;(Knight e8 c8) ;(Bishop d8 a8) ;(Rook h8 g8) ;(Queen f8) (King e8) ) ) )