Annotation of 43BSDReno/games/backgammon/teachgammon/ttext1.c, revision 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: (1) source distributions retain this entire copyright
        !             7:  * notice and comment, and (2) distributions including binaries display
        !             8:  * the following acknowledgement:  ``This product includes software
        !             9:  * developed by the University of California, Berkeley and its contributors''
        !            10:  * in the documentation or other materials provided with the distribution
        !            11:  * and in all advertising materials mentioning features or use of this
        !            12:  * software. Neither the name of the University nor the names of its
        !            13:  * contributors may be used to endorse or promote products derived
        !            14:  * from this software without specific prior written permission.
        !            15:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
        !            16:  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
        !            17:  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
        !            18:  */
        !            19: 
        !            20: #ifndef lint
        !            21: static char sccsid[] = "@(#)ttext1.c   5.4 (Berkeley) 6/1/90";
        !            22: #endif /* not lint */
        !            23: 
        !            24: #include "back.h"
        !            25: 
        !            26: char   *opts = " QIMRHEDSPT";
        !            27: char   *prompt = "-->";
        !            28: 
        !            29: char *list[] = {
        !            30:     "\n\n\tI\tIntroduction to Backgammon",
        !            31:     "\tM\tMoves and Points",
        !            32:     "\tR\tRemoving Men from the Board",
        !            33:     "\tH\tHitting Blots",
        !            34:     "\tE\tEnding the Game and Scoring",
        !            35:     "\tD\tDoubling",
        !            36:     "\tS\tStrategy",
        !            37:     "\tP\tThe Program and How to Use It",
        !            38:     "\nalso, you can type:",
        !            39:     "\t?\tto get this list",
        !            40:     "\tQ\tto go start playing",
        !            41:     "\tT\tto go straight to the tutorial",
        !            42:     0
        !            43: };
        !            44: 
        !            45: char   *hello[] = {
        !            46:     "\n\032   These rules consist of text describing how to play Backgammon",
        !            47:     "followed by a tutorial session where you play a practice game",
        !            48:     "against the computer.  When using this program, think carefuly",
        !            49:     "before typing, since it reacts as soon as you type something.  In",
        !            50:     "addition, the program presents text output, such as these rules,",
        !            51:     "in small blocks that will not roll off the top of the screen.",
        !            52:     "Frequently, you will see the characters '-->' indicating that the",
        !            53:     "program is waiting for you to finish reading, and will continue",
        !            54:     "printing when you type a space or newline.  Also, the rules are",
        !            55:     "divided into sections, and although you should read them in or-",
        !            56:     "der, you can go directly to any of them by typing one of the fol-",
        !            57:     "lowing letters:",
        !            58:     "(Remember to hit a space or a newline to continue.)",
        !            59:     "",
        !            60:     0
        !            61: };
        !            62: 
        !            63: char   *intro1[] = {
        !            64:     "\nIntroduction:",
        !            65:     "\n   Backgammon is a game involving the skill of two players and",
        !            66:     "the luck of two dice.  There are two players, red and white, and",
        !            67:     "each player gets fifteen men.  The object of the game is to re-",
        !            68:     "move all your men from the board before the opponent does.  The",
        !            69:     "board consists of twenty-four positions, a 'bar' and a 'home' for",
        !            70:     "each player.  It looks like this:",
        !            71:     "",
        !            72:     0};
        !            73: 
        !            74: char   *intro2[] = {
        !            75:     "",
        !            76:     "\n   Although not indicated on the board, the players' homes are",
        !            77:     "located just to the right of the board.  A player's men are placed",
        !            78:     "there when they are removed from the board.  The board you just",
        !            79:     "saw was in it's initial position.  All games start with the board",
        !            80:     "looking like this.  Notice that red's pieces are represented by the",
        !            81:     "letter 'r' and white's pieces are represented by the letter 'w'.",
        !            82:     "Also, a position may have zero or more pieces on it, e.g.  posi-",
        !            83:     "tion 12 has five red pieces on it, while position 11 does not",
        !            84:     "have any pieces of either color.",
        !            85:     "",
        !            86:     0};
        !            87: 
        !            88: char   *moves[] = {
        !            89:     "\nMoves and Points:",
        !            90:     "\n   Moves are made along the positions on the board according to",
        !            91:     "their numbers.  Red moves in the positive direction (clockwise",
        !            92:     "from 1 to 24), and white moves in the negative direction (coun-",
        !            93:     "terclockwise from 24 to 1).",
        !            94:     "\n   A turn consists of rolling the dice, and moving the number of",
        !            95:     "positions indicated on each die.  The two numbers can be used to",
        !            96:     "move one man the sum of the two rolls, or two men the number on",
        !            97:     "each individual die.  For example, if red rolled 6 3 at the start",
        !            98:     "of the game, he might move a man from 1 to 7 to 10, using both",
        !            99:     "dice for one man, or he might move two men from position 12, one",
        !           100:     "to 15 and one to 18.  (Red did not have to choose two men start-",
        !           101:     "ing from the same position.)  In addition, doubles are treated",
        !           102:     "specially in backgammon.  When a player rolls doubles, he gets to",
        !           103:     "move as if he had four dice instead of two.  For instance, if you",
        !           104:     "rolled double 2's, you could move one man eight positions, four",
        !           105:     "men two positions each, or any permutation in between.",
        !           106:     "",
        !           107:     "\n   However, there are certain limitations, called 'points.'  A",
        !           108:     "player has a point when he has two or more men on the same posi-",
        !           109:     "tion.  This gives him custody of that position, and his opponent",
        !           110:     "cannot place his men there, even if passing through on the way to",
        !           111:     "another position.  When a player has six points in a row, it is",
        !           112:     "called a 'wall,' since any of his opponent's men behind the wall",
        !           113:     "cannot pass it and are trapped, at least for the moment.  Notice",
        !           114:     "that this could mean that a player could not use part or all of",
        !           115:     "his roll.  However, he must use as much of his roll as possible.",
        !           116:     "",
        !           117:     0};
        !           118: 
        !           119: char   *remove[] = {
        !           120:     "\nRemoving Men from the Board:",
        !           121:     "\n   The most important part of the game is removing men, since",
        !           122:     "that is how you win the game.  Once a man is removed, he stays",
        !           123:     "off the board for the duration of the game.  However, a player",
        !           124:     "cannot remove men until all his men are on his 'inner table,' or",
        !           125:     "the last six positions of the board (19-24 for red, 6-1 for",
        !           126:     "white).",
        !           127:     "\n   To get off the board, a player must roll the exact number to",
        !           128:     "get his man one position past the last position on the board, or",
        !           129:     "his 'home.'  Hence, if red wanted to remove a man from position",
        !           130:     "23, he would have to roll a 2, anything else would be used for",
        !           131:     "another man, or for another purpose.  However, there is one ex-",
        !           132:     "ception.  If the player rolling has no men far enough to move the",
        !           133:     "roll made, he may move his farthest man off the board.  For exam-",
        !           134:     "ple, if red's farthest man back was on position 21, he could re-",
        !           135:     "move men from that position if he rolled a 5 or a 6, as well as a",
        !           136:     "4.  Since he does not have men on 20 (where he could use a 5) or",
        !           137:     "on 19 (where he could use a 6), he can use these rolls for posi-",
        !           138:     "tion 21.  A player never has to remove men, but he must make as",
        !           139:     "many moves as possible.",
        !           140:     "",
        !           141:     0};
        !           142: 
        !           143: char   *hits[] = {
        !           144:     "\nHitting Blots:",
        !           145:     "\n   Although two men on a position form an impenetrable point, a",
        !           146:     "lone man is not so secure.  Such a man is called a 'blot' and has",
        !           147:     "the potential of getting hit by an opposing man.  When a player's",
        !           148:     "blot is hit, he is placed on the bar, and the first thing that",
        !           149:     "player must do is move the man off the bar.  Such moves are",
        !           150:     "counted as if the bar is one position behind the first position",
        !           151:     "on the board.  Thus if red has a man on the bar and rolls 2 3, he",
        !           152:     "must move the man on the bar to position 2 or 3 before moving any",
        !           153:     "other man.  If white had points on positions 2 and 3, then red",
        !           154:     "would forfeit his turn.  Being on the bar is a very bad position,",
        !           155:     "for often a player can lose many turns trying to move off the",
        !           156:     "bar, as well as being set back the full distance of the board.",
        !           157:     "",
        !           158:     0};
        !           159: 
        !           160: char   *endgame[] = {
        !           161:     "\nEnding the Game and Scoring:",
        !           162:     "\n   Winning a game usually wins one point, the normal value of a",
        !           163:     "game.  However, if the losing player has not removed any men yet,",
        !           164:     "then the winning player wins double the game value, called a",
        !           165:     "'gammon.'  If the losing player has a player on the bar or on the",
        !           166:     "winner's inner table, then the winner gets triple the game value,",
        !           167:     "which is called a 'backgammon.'  (So that's where the name comes",
        !           168:     "from!)",
        !           169:     "",
        !           170:     0};

unix.superglobalmegacorp.com

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