Annotation of 42BSD/games/backgammon/allow.c, revision 1.1

1.1     ! root        1: static char sccsid[] = "       allow.c 4.1     82/05/11        ";
        !             2: 
        !             3: #include "back.h"
        !             4: 
        !             5: movallow ()  {
        !             6: 
        !             7:        register int    i, m, iold;
        !             8:        int             r;
        !             9: 
        !            10:        if (d0)
        !            11:                swap;
        !            12:        m = (D0 == D1? 4: 2);
        !            13:        for (i = 0; i < 4; i++)
        !            14:                p[i] = bar;
        !            15:        i = iold = 0;
        !            16:        while (i < m)  {
        !            17:                if (*offptr == 15)
        !            18:                        break;
        !            19:                h[i] = 0;
        !            20:                if (board[bar])  {
        !            21:                        if (i == 1 || m == 4)
        !            22:                                g[i] = bar+cturn*D1;
        !            23:                        else
        !            24:                                g[i] = bar+cturn*D0;
        !            25:                        if (r = makmove(i))  {
        !            26:                                if (d0 || m == 4)
        !            27:                                        break;
        !            28:                                swap;
        !            29:                                movback (i);
        !            30:                                if (i > iold)
        !            31:                                        iold = i;
        !            32:                                for (i = 0; i < 4; i++)
        !            33:                                        p[i] = bar;
        !            34:                                i = 0;
        !            35:                        } else
        !            36:                                i++;
        !            37:                        continue;
        !            38:                }
        !            39:                if ((p[i] += cturn) == home)  {
        !            40:                        if (i > iold)
        !            41:                                iold = i;
        !            42:                        if (m == 2 && i)  {
        !            43:                                movback(i);
        !            44:                                p[i--] = bar;
        !            45:                                if (p[i] != bar)
        !            46:                                        continue;
        !            47:                                else
        !            48:                                        break;
        !            49:                        }
        !            50:                        if (d0 || m == 4)
        !            51:                                break;
        !            52:                        swap;
        !            53:                        movback (i);
        !            54:                        for (i = 0; i < 4; i++)
        !            55:                                p[i] = bar;
        !            56:                        i = 0;
        !            57:                        continue;
        !            58:                }
        !            59:                if (i == 1 || m == 4)
        !            60:                        g[i] = p[i]+cturn*D1;
        !            61:                else
        !            62:                        g[i] = p[i]+cturn*D0;
        !            63:                if (g[i]*cturn > home)  {
        !            64:                        if (*offptr >= 0)
        !            65:                                g[i] = home;
        !            66:                        else
        !            67:                                continue;
        !            68:                }
        !            69:                if (board[p[i]]*cturn > 0 && (r = makmove(i)) == 0)
        !            70:                        i++;
        !            71:        }
        !            72:        movback (i);
        !            73:        return (iold > i? iold: i);
        !            74: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.