(include "Z_GenImg.lib") ; Notes: The rules are nearly incomprehensible so I had to make some reasonable ; (and also unreasonable) assumptions and some of my own rules in order to make ; this game work. A king and queen can move "orthogonal, diagonal, or oblique" ; but I think it is the same as FIDE chess. Some rules, such as tally of points ; are not implemented. And I don't know what the Imperial setup is. (define add1 (verify not-friend?) (if (and (not-piece? CastleEffect) (not-piece? Civilian) (not-piece? ArrestedCivilian) ) add ) ) (define king-move ($1 (add1)) ) (define queen-move ($1 (while empty? (add1) $1) (add1)) ) (define min-move ($1 (while empty? (add1) $1)) ) (define knight-move ($1 (verify (not-piece? CastleEffect)) $2 (add1)) ($1 (verify (not-piece? CastleEffect)) $3 (add1)) ) (define assassin-move ($1 (verify empty?) (add-partial $2)) ) (define assassin-c-move ( $1 (verify not-friend?) (verify not-empty?) (verify (not-piece? Civilian)) (verify (not-piece? ArrestedCivilian)) add ) ) (define pawn-add (if (and (not-piece? CastleEffect) (not-piece? Civilian) (not-piece? ArrestedCivilian) ) (if (on-board? n) add else (add Queen PrimeMinister Minister Knight Tower Assassin Deputy) ) ) ) (define civilian-move ($1 (while (and (not-piece? CastleEffect) not-empty?) $1) (add1)) ) (define deputy-move ( $1 (while (and (not-piece? CastleEffect) not-empty?) (if enemy? (if (or (piece? Civilian) (piece? ArrestedCivilian)) (change-type ArrestedCivilian) else (change-type ArrestedNonCivilian) ) ) $1 ) (add1) ) ) (define valid-wall (or (piece? Civilian $1) (piece? Deputy $1) (piece? Tower $1) (piece? ArrestedCivilian $1) ) ) (define add-effect (set-position-flag do-not-remove true $1) (if (empty? $1) (create CastleEffect $1)) ) (game (title "Little Cheops (Common no castles)") (players Red Cyan ?Castle) (board (9x9board) (dummy dummycell) (full-symmetry Cyan) ) (board-setup (Red (King e1) (Queen f1) (PrimeMinister d1) (Minister b1 c1) (Knight g1 h1) (Tower a1 i1) (Pawn a2 b2 c2 d2 e2 f2 g2 h2 i2) (Civilian d4 f4) ) (Cyan (King e9) (Queen d9) (PrimeMinister f9) (Minister g9 h9) (Knight b9 c9) (Tower a9 i9) (Pawn a8 b8 c8 d8 e8 f8 g8 h8 i8) (Civilian d6 f6) ) (?Castle (CastleMoves dummycell) ) ) (turn-order (Red normal-move) (Cyan normal-move)) (loss-condition (Red Cyan) (checkmated King)) (loss-condition (Red Cyan) stalemated) (loss-condition (Red Cyan) (pieces-remaining 0 King)) (piece (name King) (image_K) (moves (move-type normal-move) (king-move n) (king-move s) (king-move e) (king-move w) (king-move nw) (king-move ne) (king-move sw) (king-move se) ( (verify (piece? CastleEffect n)) (verify (piece? CastleEffect s)) (verify (piece? CastleEffect e)) (verify (piece? CastleEffect w)) a1 (while (on-board? next-cell) (if (and (piece? Civilian) friend?) (add-copy Deputy)) next-cell ) ) ) ) (piece (name Queen) (image_Q) (moves (move-type normal-move) (queen-move n) (queen-move s) (queen-move e) (queen-move w) (queen-move nw) (queen-move ne) (queen-move sw) (queen-move se) ) ) (piece (name PrimeMinister) (image_X) (moves (move-type normal-move) (min-move nw) (min-move ne) (min-move sw) (min-move se) (king-move n) (king-move s) (king-move e) (king-move w) (king-move nw) (king-move ne) (king-move sw) (king-move se) ) ) (piece (name Minister) (image_M) (moves (move-type normal-move) (queen-move nw) (queen-move ne) (queen-move sw) (queen-move se) ) ) (piece (name Knight) (image_N) (moves (move-type normal-move) (knight-move n nw ne) (knight-move s sw se) (knight-move e se ne) (knight-move w nw sw) ) ) (piece (name Tower) (image_T) (moves (move-type normal-move) (queen-move n) (queen-move s) (queen-move e) (queen-move w) ) ) (piece (name Assassin) (image_A) (moves (move-type normal-move) (assassin-move n second-move) (assassin-move s second-move) (assassin-move e second-move) (assassin-move w second-move) (assassin-move nw second-move) (assassin-move ne second-move) (assassin-move sw second-move) (assassin-move se second-move) (assassin-c-move n) (assassin-c-move s) (assassin-c-move e) (assassin-c-move w) (assassin-c-move nw) (assassin-c-move ne) (assassin-c-move sw) (assassin-c-move se) (move-type second-move) (assassin-move n last-move) (assassin-move s last-move) (assassin-move e last-move) (assassin-move w last-move) (assassin-move nw last-move) (assassin-move ne last-move) (assassin-move sw last-move) (assassin-move se last-move) (move-type last-move) (assassin-move n invalid-move) (assassin-move s invalid-move) (assassin-move e invalid-move) (assassin-move w invalid-move) (assassin-move nw invalid-move) (assassin-move ne invalid-move) (assassin-move sw invalid-move) (assassin-move se invalid-move) (move-type invalid-move) ) ) (piece (name Pawn) (image_P) (moves (move-type normal-move) (n (verify empty?) (pawn-add)) (ne (verify enemy?) (pawn-add)) (nw (verify enemy?) (pawn-add)) (s (verify (not-on-board? s)) n n (verify empty?) n (verify empty?) add) ) ) (piece (name Civilian) (image_C) (moves (move-type normal-move) (civilian-move n) (civilian-move s) (civilian-move e) (civilian-move w) (civilian-move nw) (civilian-move ne) (civilian-move se) (civilian-move sw) ) ) (piece (name Deputy) (image_D) (moves (move-type normal-move) (deputy-move n) (deputy-move s) (deputy-move e) (deputy-move w) (deputy-move nw) (deputy-move ne) (deputy-move se) (deputy-move sw) ) ) (piece (name ArrestedNonCivilian) (image__) ) (piece (name ArrestedCivilian) (image_0) ) (piece (name CastleEffect) (image ?Castle "images\_GenericImages\blocked.bmp") ) (piece (name CastleMoves) (moves ( a1 (while (on-board? next-cell) (if (and (on-board? nw) (on-board? ne) (on-board? sw) (on-board? se)) (if (and (valid-wall nw) (valid-wall ne) (valid-wall sw) (valid-wall se)) (add-effect w) (add-effect e) (add-effect n) (add-effect s) ) ) next-cell ) a1 (while (on-board? next-cell) (if (and (piece? CastleEffect) (not-position-flag? do-not-remove)) capture ) next-cell ) dummycell add ) ) ) ) (variant (title "Little Cheops (Common with castles)") (turn-order (Red normal-move) ?Castle (Cyan normal-move) ?Castle) ) (variant (title "Little Cheops (10x10)") (board (10x10board) (dummy dummycell) (full-symmetry Cyan) ) (board-setup (Red (King f0) (Queen g0) (PrimeMinister e0) (Minister c0 d0) (Knight h0 i0) (Tower b0 j0) (Pawn a1 b1 c1 d1 e1 f1 g1 h1 i1 j1) (Civilian c3 e3 g3) (Assassin a0) ) (Cyan (King e9) (Queen d9) (PrimeMinister f9) (Minister g9 h9) (Knight b9 c9) (Tower a9 i9) (Pawn a8 b8 c8 d8 e8 f8 g8 h8 i8 j8) (Civilian d6 f6 h6) (Assassin j9) ) (?Castle (CastleMoves dummycell) ) ) (turn-order (Red normal-move) ?Castle (Cyan normal-move) ?Castle) )