char *formatflags() { static char fmt[20]; fmt[0] = flag_test(wqcastlep(), 'Q'); fmt[1] = flag_test(wkcastlep(), 'K'); fmt[2] = flag_test(bqcastlep(), 'q'); fmt[3] = flag_test(bkcastlep(), 'k'); fmt[4] = flag_test(castledp(), 'C'); fmt[5] = flag_test(enpassantedp(), 'E'); fmt[6] = flag_test(doublepushp(), 'P'); fmt[7] = flag_test(wkcastledp(), 'K'); fmt[8] = flag_test(wqcastledp(), 'Q'); fmt[9] = flag_test(bkcastledp(), 'k'); fmt[10] = flag_test(bqcastledp(), 'q'); fmt[11] = tomove() == WHITE ? 'W' : 'B'; fmt[12] = 0; return fmt; }
void getmovesk(int f, int r, int c) { int df, dr, nf, nr; int o; chesspiece p; square s1 = SQ(f,r); o = opp(c); for (df=-1; df<2; df++) for (dr=-1; dr<2; dr++) { if (!df && !dr) continue; nf = f+df; nr = r+dr; p = getpiece(nf, nr); if (!offboardp(nf, nr) && (!p || (c != chesspiececolor(p)))) pushmove(MV(s1, SQ(nf, nr))); } if (c==WHITE) { if (wqcastlep()&& !getpiece__(D1)&& !getpiece__(C1)&& !getpiece__(B1)&& !incheckp(c)&& !wouldbeincheckp(THRUWQ)) { pushmove(WQC); } if (wkcastlep()&& !getpiece__(F1)&& !getpiece__(G1)&& !incheckp(c)&& !wouldbeincheckp(THRUWK)) { pushmove(WKC); } } else { if (bqcastlep()&& !getpiece__(D8)&& !getpiece__(C8)&& !getpiece__(B8)&& !incheckp(c)&& !wouldbeincheckp(THRUBQ)) { pushmove(BQC); } if (bkcastlep()&& !getpiece__(F8)&& !getpiece__(G8)&& !incheckp(c)&& !wouldbeincheckp(THRUBK)) { pushmove(BKC); } } }