Exemple #1
0
void printboard_and_time()
{
    int full, part;
    
    printboard();
    
    printf("W %s\t", formattime(chessclock[WHITE]));
    printf("B %s\n", formattime(chessclock[BLACK]));

    full = fullincheckp(tomove());
    part = ply ? incheckp(tomove()) : 0;
    
    if (full)
	printf("In Check : %d\n", full);

    if ((part &&  !full)||(full && !part))
    {
	printf("partial checktest (%d) and full checktest (%d) do no agree\n",
	       part, full);
    }
    
    printf("%c To Move\n", (tomove()==WHITE) ? 'W' : 'B');
}
Exemple #2
0
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);
        }
    }
}