(game (title "Must Capture Chess") (description "All capturing is mandatory, though you may choose which capture to make.\\Note that a King can't capture a defended piece. If the King is in check and a capture is available, the King can escape with a non-capturing King move, but the check can't be interposed against.") (history "This variant is found in the Alfonso codex, (written around 1280), but would originally have been a variant for Shatranj. It is attributed to the women of Morocco. It is also called the Forced Game or the Maiden's game.\\ZRF by Roger Cooper, RogerCoop@aol.com") (strategy "The value of pieces relative to pawns is less than in standard chess.") (move-priorities capture-move non-capture-move) (define king-shift-capture ($1 (verify enemy?) (verify not-attacked?) (set-attribute never-moved? false) add) ) (define king-shift-move ($1 (verify empty?) (verify not-attacked?) (set-attribute never-moved? false) add) ) (define king-shift-escape ((verify attacked?)$1 (verify empty?) (verify not-attacked?) (set-attribute never-moved? false) add) ) (define rook-slide-capture ($1 (while empty? $1) (verify enemy?) (set-attribute never-moved? false) add) ) (define rook-slide-move ($1 (while empty? (set-attribute never-moved? false) add $1)) ) (define slide-capture ($1 (while empty? $1) (verify enemy?) add) ) (define slide-move ($1 (while empty? add $1)) ) (define leap2-capture ($1 $2 (verify enemy?) add) ) (define leap2-move ($1 $2 (verify empty?) add) ) (define Pawn-capture ( $1 (verify enemy?) (Pawn-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 En-Passant ( $1 (verify enemy?) (verify last-to?) (verify (piece? Pawn)) capture n to n (verify last-from?) 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 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) ) ) (board (Board-Definitions)) (players White Black) (turn-order White Black) (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 King) (help "King: steps 1 square in any direction, castles with rook") (description "King\A King can move to any adjacent square. 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.") (image White "images\Chess\wking.bmp" Black "images\Chess\bking.bmp") (attribute never-moved? true) (moves (move-type capture-move) (king-shift-capture n) (king-shift-capture e) (king-shift-capture s) (king-shift-capture w) (king-shift-capture ne) (king-shift-capture nw) (king-shift-capture se) (king-shift-capture sw) (king-shift-escape n) (king-shift-escape e) (king-shift-escape s) (king-shift-escape w) (king-shift-escape ne) (king-shift-escape nw) (king-shift-escape se) (king-shift-escape sw) (move-type non-capture-move) (king-shift-move n) (king-shift-move e) (king-shift-move s) (king-shift-move w) (king-shift-move ne) (king-shift-move nw) (king-shift-move se) (king-shift-move sw) (O-O) (O-O-O) ) ) (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 (move-type capture-move) (slide-capture n) (slide-capture e) (slide-capture s) (slide-capture w) (slide-capture ne) (slide-capture nw) (slide-capture se) (slide-capture sw) (move-type non-capture-move) (slide-move n) (slide-move e) (slide-move s) (slide-move w) (slide-move ne) (slide-move nw) (slide-move se) (slide-move 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) (moves (move-type capture-move) (rook-slide-capture n) (rook-slide-capture e) (rook-slide-capture s) (rook-slide-capture w) (move-type non-capture-move) (rook-slide-move n) (rook-slide-move e) (rook-slide-move s) (rook-slide-move 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 (move-type capture-move) (slide-capture ne) (slide-capture nw) (slide-capture se) (slide-capture sw) (move-type non-capture-move) (slide-move ne) (slide-move nw) (slide-move se) (slide-move sw) ) ) (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 (move-type capture-move) (leap2-capture n ne) (leap2-capture n nw) (leap2-capture s se) (leap2-capture s sw) (leap2-capture e ne) (leap2-capture e se) (leap2-capture w nw) (leap2-capture w sw) (move-type non-capture-move) (leap2-move n ne) (leap2-move n nw) (leap2-move s se) (leap2-move s sw) (leap2-move e ne) (leap2-move e se) (leap2-move w nw) (leap2-move w sw) ) ) (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 one square ahead ;and diagonally. If a Pawn reaches the far rank it promotes, changing ;into a Knight, Bishop, Rook, or Queen. 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.") (image White "images\Chess\wpawn.bmp" Black "images\Chess\bpawn.bmp") (moves (move-type capture-move) (Pawn-capture nw) (Pawn-capture ne) (En-Passant e) (En-Passant w) (move-type non-capture-move) (Pawn-move) ) ) (win-sound "Audio\Orchestra_CF.wav") (loss-sound "Audio\Orchestra_FC.wav") (click-sound "Audio\Pickup.wav") (release-sound "Audio\WoodThunk.wav") (pass-turn false) (loss-condition (White Black) (checkmated King) ) ) (variant (title "Take the King") ;************************************************ (define king-shift-capture ($1 (verify enemy?) (set-attribute never-moved? false) add) ) (define king-shift-move ($1 (verify empty?) (set-attribute never-moved? false) add) ) (piece (name King) (help "King: steps 1 square in any direction, castles with rook") (description "King\A King can move to any adjacent square. 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.") (image White "images\Chess\wking.bmp" Black "images\Chess\bking.bmp") (attribute never-moved? true) (moves (move-type capture-move) (king-shift-capture n) (king-shift-capture e) (king-shift-capture s) (king-shift-capture w) (king-shift-capture ne) (king-shift-capture nw) (king-shift-capture se) (king-shift-capture sw) (move-type non-capture-move) (king-shift-move n) (king-shift-move e) (king-shift-move s) (king-shift-move w) (king-shift-move ne) (king-shift-move nw) (king-shift-move se) (king-shift-move sw) (O-O) (O-O-O) ) ) (description "All capturing is mandatory, though you may choose which capture to make.\\Note that a King can capture a defended piece. If the King is in a check but a capture is available you will lose. There is no checkmate, but losing the King loses the game") (strategy "Be careful with your King") (loss-condition (White Black) (captured King) ) )