Annotation of 43BSDTahoe/games/backgammon/text.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1980 Regents of the University of California.
                      3:  * All rights reserved.
                      4:  *
                      5:  * Redistribution and use in source and binary forms are permitted
                      6:  * provided that the above copyright notice and this paragraph are
                      7:  * duplicated in all such forms and that any documentation,
                      8:  * advertising materials, and other materials related to such
                      9:  * distribution and use acknowledge that the software was developed
                     10:  * by the University of California, Berkeley.  The name of the
                     11:  * University may not be used to endorse or promote products derived
                     12:  * from this software without specific prior written permission.
                     13:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
                     14:  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
                     15:  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
                     16:  */
                     17: 
                     18: #ifndef lint
                     19: static char sccsid[] = "@(#)text.c     5.3 (Berkeley) 6/18/88";
                     20: #endif /* not lint */
                     21: 
                     22: #include "back.h"
                     23: 
                     24: char *instr[] = {
                     25:     "    If you did not notice by now, this program reacts to things as",
                     26:     "soon as you type them, without waiting for a newline.  This means that",
                     27:     "the special characters RUBOUT, ESC, and CONTROL-D, will not perform",
                     28:     "their special functions during most of this program.  The program",
                     29:     "should usually stop when a RUBOUT is typed, but occasionally it will",
                     30:     "ignore RUBOUTs until it is waiting for input.\n",
                     31:     "    These instructions are presented in small chunks designed not to",
                     32:     "roll off the top of your screen.  When the characters '-->' are print-",
                     33:     "ed, no more data will be printed until a space or newline is typed.",
                     34:     "In this way, you can finish one section before continuing to another.",
                     35:     "Like this:",
                     36:     "",
                     37:     "    The two sides are colored 'red' and 'white.' The computer may play",
                     38:     "one side, or if there are two players, the computer can merely act as",
                     39:     "a gamekeeper, letting the players make the moves.  Once you tell the",
                     40:     "computer what color(s) you want to play, the decision remains in ef-",
                     41:     "fect until you quit the program, even if you play more than one game,",
                     42:     "since the program keeps a running score.\n",
                     43:     "    The program will prompt for a move in one of two ways.  If the",
                     44:     "player has the opportunity to double, then merely his color will be",
                     45:     "typed out.  The player can now do one of several things.  He can dou-",
                     46:     "ble by typing a 'd', he can roll by typing a space (' ') or newline,",
                     47:     "or if he is not sure, he can reprint the board by typing a 'r'.\n",
                     48:     "    If the player cannot double, his roll will be thrust in front of",
                     49:     "him, followed by the request 'Move:', asking for a move but not giving",
                     50:     "him the chance to double.  He can still ask for the board by typing",
                     51:     "'r'.  In either of these two states, the player can quit by typing 'q'",
                     52:     "or save the game by typing 's'.  In either case, the player will be",
                     53:     "asked to verify, in case there was some error.  The program then ends",
                     54:     "immediately, after first saving the file if so requested.",
                     55:     "",
                     56:     "    A player can move one of his men using two forms of input.  The",
                     57:     "first form is <s>-<f>, where <s> is the starting position, and <f> is",
                     58:     "the finishing position of the player's man.  For example, if white",
                     59:     "wanted to move a piece from position 13 to position 8, his move could",
                     60:     "be entered as 13-8.  The second form is <s>/<r> where <s> is the",
                     61:     "starting position, an <r> is the roll actually made.  Hence, white",
                     62:     "could have entered as 13/5 instead of 13-8.\n",
                     63:     "    A player must move each roll of the dice separately.  For example,",
                     64:     "if a player rolled 4 3, and wanted to move from 13 to 6, he could",
                     65:     "enter it as 13/4,9/3 or 13/3,10/4 or 13-10,10-6 or 13-9,9-6, but not",
                     66:     "13-6.  The last two entries can be shortened to 13-10-6 and 13-9-6.",
                     67:     "If you want to move more than one piece from the same position, such",
                     68:     "as 13-10,13-9, you can abbreviate this using the <s>/<r> format as by",
                     69:     "entering more than one <r>, or 13/34.  A player can use both forms for",
                     70:     "the same roll, e.g. 13/3,13-9, and separates individual moves by ei-",
                     71:     "ther a comma or a space.  The letter 'b' represents the bar, and the",
                     72:     "letter 'h' represents a player's home.  You could also enter the",
                     73:     "number that would be in the position of the bar, 25 or 0 as appropri-",
                     74:     "ate.  Use a newline at the end of your moves for a turn.",
                     75:     "",
                     76:     "    As you type in your move, if a character does not make sense under",
                     77:     "the above constrictions, a bell will sound instead of the character,",
                     78:     "and it will be ignored.  You may kill lines and erase characters as",
                     79:     "you would normally, but don't be surprised if they look different than",
                     80:     "usual.  Also, if you have entered one or more of your rolls, and you",
                     81:     "wish to see what the move looks like so far, type a 'r' to see what it",
                     82:     "looks like.  This cannot be done in the middle of a move (e.g., after",
                     83:     "a '-' or '/').  After the printing board, the program will go back to",
                     84:     "inputting your move and you can backspace or kill just as if you had",
                     85:     "just typed in your input.\n",
                     86:     "    Now you should be ready to begin the game.  Good luck!",
                     87:     "",
                     88:     0};
                     89: 
                     90: 
                     91: text (t)
                     92: char   **t;
                     93: 
                     94: {
                     95:        register int    i;
                     96:        register char   *s, *a;
                     97: 
                     98:        fixtty (noech);
                     99:        while (*t != 0)  {
                    100:                s = a = *t;
                    101:                for (i = 0; *a != '\0'; i--)
                    102:                        a++;
                    103:                if (i)  {
                    104:                        writel (s);
                    105:                        writec ('\n');
                    106:                } else  {
                    107:                        writel ("-->");
                    108:                        fixtty (raw);
                    109:                        while ((i = readc()) != ' ' && i != '\n');
                    110:                        fixtty (noech);
                    111:                        clear();
                    112:                }
                    113:                t++;
                    114:        }
                    115:        fixtty (raw);
                    116: }

unix.superglobalmegacorp.com

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