Annotation of 43BSD/games/backgammon/ttext1.c, revision 1.1

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

unix.superglobalmegacorp.com

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