// Korean Chess include file include xiangqi; allow swap 1 swap 2 moves 2 moves 3; // Mark diagonally linked coordinates in palaces. set many d1 1 f1 1 e2 1 d3 1 f3 1 d8 1 f8 1 e9 1 d10 1 f10 1; def c != tolower space screen c and checkhop #0 #1 1 1 and var #0 and var #1 or and != tolower space screen c checkhop #0 #1 0 1 and != C cond empty #0 captured space #1; def C != toupper space screen C and checkhop #0 #1 1 1 and var #0 and var #1 or and != toupper space screen C checkhop #0 #1 0 1 and != c cond empty #0 captured space #1; // def c != toupper space screen C cond or == rank #0 rank #1 == file #0 file #1 (checkhop #0 #1 0 1) (and checkhop #0 #1 1 1 and var #0 var #1) and != C cond empty #0 captured space #1; // def C != toupper space screen C cond or == rank #0 rank #1 == file #0 file #1 (checkhop #0 #1 0 1) (and checkhop #0 #1 1 1 and var #0 var #1) and != c cond empty #0 captured space #1; def e checkpath #0 #1 1 0 1 1 1 1; def E checkpath #0 #1 1 0 1 1 1 1; def r checkride #0 #1 1 1 and var #0 and var #1 or checkride #0 #1 1 0; def R checkride #0 #1 1 1 and var #0 and var #1 or checkride #0 #1 1 0; def f checkleap #0 #1 1 1 and var #0 and var #1 or or checkleap #0 #1 1 0 and flag #1; def F checkleap #0 #1 1 1 and var #0 and var #1 or or checkleap #0 #1 1 0 and flag #1; def p checkleap #0 #1 1 1 and var #0 and var #1 or checkleap #0 #1 1 0 and >= rank #0 rank #1; def P checkleap #0 #1 1 1 and var #0 and var #1 or checkleap #0 #1 1 0 and <= rank #0 rank #1; def g checkleap #0 #1 1 1 and var #0 and var #1 or or checkleap #0 #1 1 0 and flag #1; def G checkleap #0 #1 1 1 and var #0 and var #1 or or checkleap #0 #1 1 0 and flag #1; def EL leaps #0 2 3; def eL leaps #0 2 3; def fL merge leaps #0 1 1 leaps #0 1 0; def FL merge leaps #0 1 1 leaps #0 1 0; def gL merge leaps #0 1 1 leaps #0 1 0; def GL merge leaps #0 1 1 leaps #0 1 0;