Annotation of 43BSD/games/backgammon/back.h, revision 1.1

1.1     ! root        1: 
        !             2: /*
        !             3:  * Copyright (c) 1980 Regents of the University of California.
        !             4:  * All rights reserved.  The Berkeley software License Agreement
        !             5:  * specifies the terms and conditions for redistribution.
        !             6:  *
        !             7:  *     @(#)back.h      5.1 (Berkeley) 5/29/85
        !             8:  */
        !             9: 
        !            10: #include <sgtty.h>
        !            11: 
        !            12: #define rnum(r)        (random()%r)
        !            13: #define D0     dice[0]
        !            14: #define D1     dice[1]
        !            15: #define swap   {D0 ^= D1; D1 ^= D0; D0 ^= D1; d0 = 1-d0;}
        !            16: 
        !            17: /*
        !            18:  *
        !            19:  * Some numerical conventions:
        !            20:  *
        !            21:  *     Arrays have white's value in [0], red in [1].
        !            22:  *     Numeric values which are one color or the other use
        !            23:  *     -1 for white, 1 for red.
        !            24:  *     Hence, white will be negative values, red positive one.
        !            25:  *     This makes a lot of sense since white is going in decending
        !            26:  *     order around the board, and red is ascending.
        !            27:  *
        !            28:  */
        !            29: 
        !            30: char   EXEC[];                 /* object for main program */
        !            31: char   TEACH[];                /* object for tutorial program */
        !            32: 
        !            33: int    pnum;                   /* color of player:
        !            34:                                        -1 = white
        !            35:                                         1 = red
        !            36:                                         0 = both
        !            37:                                         2 = not yet init'ed */
        !            38: char   args[100];              /* args passed to teachgammon and back */
        !            39: int    acnt;                   /* length of args */
        !            40: int    aflag;                  /* flag to ask for rules or instructions */
        !            41: int    bflag;                  /* flag for automatic board printing */
        !            42: int    cflag;                  /* case conversion flag */
        !            43: int    hflag;                  /* flag for cleaning screen */
        !            44: int    mflag;                  /* backgammon flag */
        !            45: int    raflag;                 /* 'roll again' flag for recovered game */
        !            46: int    rflag;                  /* recovered game flag */
        !            47: int    tflag;                  /* cursor addressing flag */
        !            48: int    rfl;                    /* saved value of rflag */
        !            49: int    iroll;                  /* special flag for inputting rolls */
        !            50: int    board[26];              /* board:  negative values are white,
        !            51:                                   positive are red */
        !            52: int    dice[2];                /* value of dice */
        !            53: int    mvlim;                  /* 'move limit':  max. number of moves */
        !            54: int    mvl;                    /* working copy of mvlim */
        !            55: int    p[5];                   /* starting position of moves */
        !            56: int    g[5];                   /* ending position of moves (goals) */
        !            57: int    h[4];                   /* flag for each move if a man was hit */
        !            58: int    cturn;                  /* whose turn it currently is:
        !            59:                                        -1 = white
        !            60:                                         1 = red
        !            61:                                         0 = just quitted
        !            62:                                        -2 = white just lost
        !            63:                                         2 = red just lost */
        !            64: int    d0;                     /* flag if dice have been reversed from
        !            65:                                   original position */
        !            66: int    table[6][6];            /* odds table for possible rolls */
        !            67: int    rscore;                 /* red's score */
        !            68: int    wscore;                 /* white's score */
        !            69: int    gvalue;                 /* value of game (64 max.) */
        !            70: int    dlast;                  /* who doubled last (0 = neither) */
        !            71: int    bar;                    /* position of bar for current player */
        !            72: int    home;                   /* position of home for current player */
        !            73: int    off[2];                 /* number of men off board */
        !            74: int    *offptr;                /* pointer to off for current player */
        !            75: int    *offopp;                /* pointer to off for opponent */
        !            76: int    in[2];                  /* number of men in inner table */
        !            77: int    *inptr;                 /* pointer to in for current player */
        !            78: int    *inopp;                 /* pointer to in for opponent */
        !            79: 
        !            80: int    ncin;                   /* number of characters in cin */
        !            81: char   cin[100];               /* input line of current move
        !            82:                                   (used for reconstructing input after
        !            83:                                   a backspace) */
        !            84: 
        !            85: char   *color[];
        !            86:                                /* colors as strings */
        !            87: char   **colorptr;             /* color of current player */
        !            88: char   **Colorptr;             /* color of current player, capitalized */
        !            89: int    colen;                  /* length of color of current player */
        !            90: 
        !            91: struct sgttyb  tty;            /* tty information buffer */
        !            92: int            old;            /* original tty status */
        !            93: int            noech;          /* original tty status without echo */
        !            94: int            raw;            /* raw tty status, no echo */
        !            95: 
        !            96: int    curr;                   /* row position of cursor */
        !            97: int    curc;                   /* column position of cursor */
        !            98: int    begscr;                 /* 'beginning' of screen
        !            99:                                   (not including board) */
        !           100: 
        !           101: int    getout();               /* function to exit backgammon cleanly */

unix.superglobalmegacorp.com

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