Initial import from FreeBSD RELENG_4:
[games.git] / games / larn / data.c
1 /*-
2  * Copyright (c) 1988 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. All advertising materials mentioning features or use of this software
14  *    must display the following acknowledgement:
15  *      This product includes software developed by the University of
16  *      California, Berkeley and its contributors.
17  * 4. Neither the name of the University nor the names of its contributors
18  *    may be used to endorse or promote products derived from this software
19  *    without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  */
33
34 #ifndef lint
35 #if 0
36 static char sccsid[] = "@(#)data.c      5.3 (Berkeley) 5/13/91";
37 #endif
38 static const char rcsid[] =
39  "$FreeBSD: src/games/larn/data.c,v 1.5 1999/11/30 03:48:59 billf Exp $";
40 #endif /* not lint */
41
42 /*      data.c          Larn is copyrighted 1986 by Noah Morgan. */
43 #define NODEFS
44 #include "header.h"
45
46 /*
47         class[c[LEVEL]-1] gives the correct name of the players experience level
48  */
49 static char aa1[] =     " mighty evil master";
50 static char aa2[] =     "apprentice demi-god";
51 static char aa3[] =     "  minor demi-god   ";
52 static char aa4[] =     "  major demi-god   ";
53 static char aa5[] =     "    minor deity    ";
54 static char aa6[] =     "    major deity    ";
55 static char aa7[] =     "  novice guardian  ";
56 static char aa8[] =     "apprentice guardian";
57 static char aa9[] =     "    The Creator    ";
58 char *class[]=
59 {       "  novice explorer  ", "apprentice explorer", " practiced explorer",/*  -3*/
60         "   expert explorer ", "  novice adventurer", "     adventurer    ",/*  -6*/
61         "apprentice conjurer", "     conjurer      ", "  master conjurer  ",/*  -9*/
62         "  apprentice mage  ", "        mage       ", "  experienced mage ",/* -12*/
63         "     master mage   ", " apprentice warlord", "   novice warlord  ",/* -15*/
64         "   expert warlord  ", "   master warlord  ", " apprentice gorgon ",/* -18*/
65         "       gorgon      ", "  practiced gorgon ", "   master gorgon   ",/* -21*/
66         "    demi-gorgon    ", "    evil master    ", " great evil master ",/* -24*/
67           aa1       ,   aa1       ,   aa1       ,/* -27*/
68           aa1       ,   aa1       ,   aa1       ,/* -30*/
69           aa1       ,   aa1       ,   aa1       ,/* -33*/
70           aa1       ,   aa1       ,   aa1       ,/* -36*/
71           aa1       ,   aa1       ,   aa1       ,/* -39*/
72           aa2       ,   aa2       ,   aa2       ,/* -42*/
73           aa2       ,   aa2       ,   aa2       ,/* -45*/
74           aa2       ,   aa2       ,   aa2       ,/* -48*/
75           aa3       ,   aa3       ,   aa3       ,/* -51*/
76           aa3       ,   aa3       ,   aa3       ,/* -54*/
77           aa3       ,   aa3       ,   aa3       ,/* -57*/
78           aa4       ,   aa4       ,   aa4       ,/* -60*/
79           aa4       ,   aa4       ,   aa4       ,/* -63*/
80           aa4       ,   aa4       ,   aa4       ,/* -66*/
81           aa5       ,   aa5       ,   aa5       ,/* -69*/
82           aa5       ,   aa5       ,   aa5       ,/* -72*/
83           aa5       ,   aa5       ,   aa5       ,/* -75*/
84           aa6       ,   aa6       ,   aa6       ,/* -78*/
85           aa6       ,   aa6       ,   aa6       ,/* -81*/
86           aa6       ,   aa6       ,   aa6       ,/* -84*/
87           aa7       ,   aa7       ,   aa7       ,/* -87*/
88           aa8       ,   aa8       ,   aa8       ,/* -90*/
89           aa8       ,   aa8       ,   aa8       ,/* -93*/
90         "  earth guardian   ", "   air guardian    ", "   fire guardian   ",/* -96*/
91         "  water guardian   ", "  time guardian    ", " ethereal guardian ",/* -99*/
92           aa9       ,   aa9       ,   aa9       ,/* -102*/
93 };
94
95 /*
96         table of experience needed to be a certain level of player
97         skill[c[LEVEL]] is the experience required to attain the next level
98  */
99 #define MEG 1000000
100 long skill[] = {
101 0, 10, 20, 40, 80, 160, 320, 640, 1280, 2560, 5120,                  /*  1-11 */
102 10240, 20480, 40960, 100000, 200000, 400000, 700000, 1*MEG,          /* 12-19 */
103 2*MEG,3*MEG,4*MEG,5*MEG,6*MEG,8*MEG,10*MEG,                          /* 20-26 */
104 12*MEG,14*MEG,16*MEG,18*MEG,20*MEG,22*MEG,24*MEG,26*MEG,28*MEG,      /* 27-35 */
105 30*MEG,32*MEG,34*MEG,36*MEG,38*MEG,40*MEG,42*MEG,44*MEG,46*MEG,      /* 36-44 */
106 48*MEG,50*MEG,52*MEG,54*MEG,56*MEG,58*MEG,60*MEG,62*MEG,64*MEG,      /* 45-53 */
107 66*MEG,68*MEG,70*MEG,72*MEG,74*MEG,76*MEG,78*MEG,80*MEG,82*MEG,      /* 54-62 */
108 84*MEG,86*MEG,88*MEG,90*MEG,92*MEG,94*MEG,96*MEG,98*MEG,100*MEG,     /* 63-71 */
109 105*MEG,110*MEG,115*MEG,120*MEG, 125*MEG, 130*MEG, 135*MEG, 140*MEG, /* 72-79 */
110 145*MEG,150*MEG,155*MEG,160*MEG, 165*MEG, 170*MEG, 175*MEG, 180*MEG, /* 80-87 */
111 185*MEG,190*MEG,195*MEG,200*MEG, 210*MEG, 220*MEG, 230*MEG, 240*MEG, /* 88-95 */
112 250*MEG,260*MEG,270*MEG,280*MEG, 290*MEG, 300*MEG                    /* 96-101*/
113 };
114 #undef MEG
115
116 char *lpbuf,*lpnt,*inbuffer,*lpend;     /* input/output pointers to the buffers */
117 struct cel *cell;       /*      pointer to the dungeon storage  */
118 short hitp[MAXX][MAXY];         /*      monster hp on level             */
119 short iarg[MAXX][MAXY]; /*      arg for the item array  */
120 char item[MAXX][MAXY];  /*      objects in maze if any  */
121 char know[MAXX][MAXY];  /*      1 or 0 if here before   */
122 char mitem[MAXX][MAXY]; /*      monster item array              */
123 char moved[MAXX][MAXY]; /*      monster movement flags  */
124 char stealth[MAXX][MAXY];       /*  0=sleeping 1=awake monst*/
125 char iven[26];                  /*      inventory for player                    */
126 short ivenarg[26];              /*      inventory for player                    */
127 char lastmonst[40];             /*      this has the name of the current monster        */
128 char beenhere[MAXLEVEL+MAXVLEVEL]={0};  /*  1 if have been on this level */
129 char VERSION=VER;       /*      this is the present version # of the program    */
130 char SUBVERSION=SUBVER;
131 char nosignal=0;        /* set to 1 to disable the signals from doing anything */
132 char predostuff=0;      /*  2 means that the trap handling routines must do a
133                                                 showplayer() after a trap.  0 means don't showplayer()
134                                                 0 - we are in create player screen
135                                                 1 - we are in welcome screen
136                                                 2 - we are in the normal game   */
137 char loginname[20];             /* players login name */
138 char logname[LOGNAMESIZE];      /* players name storage for scoring                             */
139 char sex=1;                             /*  default is a man  0=woman                                           */
140 char boldon=1;                  /*  1=bold objects  0=inverse objects                           */
141 char ckpflag=0;                 /*      1 if want checkpointing of game, 0 otherwise    */
142 char cheat=0;                   /*      1 if the player has fudged save file                    */
143 char level=0;                   /*  cavelevel player is on = c[CAVELEVEL]                       */
144 char wizard=0;                  /*      the wizard mode flag                                                    */
145 short lastnum=0;                /* the number of the monster last hitting player        */
146 short hitflag=0;                /*      flag for if player has been hit when running    */
147 short hit2flag=0;               /*      flag for if player has been hit when running    */
148 short hit3flag=0;               /*      flag for if player has been hit flush input     */
149 short playerx,playery;  /*      the room on the present level of the player             */
150 short lastpx,lastpy;    /*      0 --- MAXX-1  or  0 --- MAXY-1                                  */
151 short oldx,oldy;
152 short lasthx=0,lasthy=0;        /* location of monster last hit by player               */
153 short nobeep=0;                 /* true if program is not to beep                                       */
154 /* unsigned long randx=33601;      /*      the random number seed                                          */
155 time_t initialtime=0;                   /* time playing began                                                   */
156 long gtime=0;                           /*      the clock for the game                                          */
157 long outstanding_taxes=0;       /* present tax bill from score file                     */
158 long c[100],cbak[100];          /*      the character description arrays                        */
159 int enable_scroll=0;            /* constant for enabled/disabled scrolling regn */
160 char aborted[] = " aborted";
161 struct sphere *spheres=0; /*pointer to linked list for spheres of annihilation*/
162 char *levelname[]=
163 { " H"," 1"," 2"," 3"," 4"," 5"," 6"," 7"," 8"," 9","10","V1","V2","V3" };
164
165 char objnamelist[]=" ATOP%^F&^+M=%^$$f*OD#~][[)))(((||||||||{?!BC}o:@.<<<<EVV))([[]]](^ [H*** ^^ S tsTLc............................................";
166 char monstnamelist[]=" BGHJKOScjtAELNQRZabhiCTYdegmvzFWflorXV pqsyUkMwDDPxnDDuD        ...............................................................";
167 char *objectname[]=
168 { 0,"a holy altar","a handsome jewel encrusted throne","the orb","a pit",
169   "a staircase leading upwards","an elevator going up","a bubbling fountain",
170   "a great marble statue","a teleport trap","the college of Larn",
171   "a mirror","the DND store","a staircase going down","an elevator going down",
172   "the bank of Larn","the 5th branch of the Bank of Larn",
173   "a dead fountain","gold","an open door","a closed door",
174   "a wall","The Eye of Larn","plate mail","chain mail","leather armor",
175   "a sword of slashing","Bessman's flailing hammer","a sunsword",
176   "a two handed sword","a spear","a dagger",
177   "ring of extra regeneration","a ring of regeneration","a ring of protection",
178   "an energy ring","a ring of dexterity","a ring of strength",
179   "a ring of cleverness","a ring of increase damage","a belt of striking",
180   "a magic scroll","a magic potion","a book","a chest",
181   "an amulet of invisibility","an orb of dragon slaying",
182   "a scarab of negate spirit","a cube of undead control",
183   "device of theft prevention","a brilliant diamond","a ruby",
184   "an enchanting emerald","a sparkling sapphire","the dungeon entrance",
185   "a volcanic shaft leaning downward","the base of a volcanic shaft",
186   "a battle axe","a longsword","a flail","ring mail","studded leather armor",
187   "splint mail","plate armor","stainless plate armor","a lance of death",
188   "an arrow trap","an arrow trap","a shield","your home",
189   "gold","gold","gold","a dart trap",
190   "a dart trap","a trapdoor","a trapdoor","the local trading post",
191   "a teleport trap", "a massive throne",
192   "a sphere of annihilation","a handsome jewel encrusted throne",
193   "the Larn Revenue Service","a fortune cookie","","","","","","",
194   "","","","","","","","","","","","","","","","","","","",""
195  };
196
197 \f
198 /*
199  *      for the monster data
200  *
201  *      array to do rnd() to create monsters <= a given level
202  */
203 char monstlevel[] = { 5, 11, 17, 22, 27, 33, 39, 42, 46, 50, 53, 56, 59 };
204
205 struct monst monster[] = {
206 /*      NAME                    LV      AC      DAM     ATT     DEF     GEN INT GOLD    HP      EXP
207 ----------------------------------------------------------------- */
208 { "",                           0,      0,      0,      0,      0,       0,  3,   0,    0,      0       },
209 { "bat",                        1,      0,      1,      0,      0,       0,  3,   0,    1,      1       },
210 { "gnome",                      1,      10,     1,      0,      0,       0,  8,  30,    2,      2       },
211 { "hobgoblin",          1,      14,     2,      0,      0,       0,  5,  25,    3,      2       },
212 { "jackal",                     1,      17,     1,      0,      0,       0,  4,   0,    1,      1       },
213 { "kobold",                     1,      20,     1,      0,      0,       0,  7,  10,    1,      1       },
214
215 { "orc",                        2,      12,     1,      0,      0,       0,  9,  40,    4,      2       },
216 { "snake",                      2,      15,     1,      0,      0,       0,  3,   0,    3,      1       },
217 { "giant centipede",2,  14,     0,      4,      0,       0,  3,   0,    1,      2       },
218 { "jaculi",                     2,      20,     1,      0,      0,       0,  3,   0,    2,      1       },
219 { "troglodyte",         2,      10,     2,      0,      0,       0,  5,  80,    4,      3       },
220 { "giant ant",          2,      8,      1,      4,      0,       0,  4,   0,    5,      5       },
221
222 /*      NAME                    LV      AC      DAM     ATT     DEF     GEN INT GOLD    HP      EXP
223 ----------------------------------------------------------------- */
224
225 { "floating eye",       3,      8,      1,      0,      0,       0,  3,   0,     5,      2      },
226 { "leprechaun",         3,      3,      0,      8,      0,       0,  3,1500,    13,     45      },
227 { "nymph",                      3,      3,      0,      14,     0,       0,  9,   0,    18,     45      },
228 { "quasit",                     3,      5,      3,      0,      0,       0,  3,   0,    10,     15      },
229 { "rust monster",       3,      4,      0,      1,      0,       0,  3,   0,    18,     25      },
230 { "zombie",                     3,      12,     2,      0,      0,       0,  3,   0,     6,      7      },
231
232 { "assassin bug",       4,      9,      3,      0,      0,       0,  3,   0,    20,     15      },
233 { "bugbear",            4,      5,      4,      15,     0,       0,  5,  40,    20,     35      },
234 { "hell hound",         4,      5,      2,      2,      0,       0,  6,   0,    16,     35      },
235 { "ice lizard",         4,      11,     2,      10,     0,       0,  6,  50,    16,     25      },
236 { "centaur",            4,      6,      4,      0,      0,       0, 10,  40,    24,     45      },
237
238 /*      NAME                    LV      AC      DAM     ATT     DEF     GEN INT GOLD    HP      EXP
239 ----------------------------------------------------------------- */
240
241 { "troll",                      5,      4,      5,      0,      0,       0,  9,  80,    50,     300     },
242 { "yeti",                       5,      6,      4,      0,      0,       0,  5,  50,    35,     100     },
243 { "white dragon",       5,      2,      4,      5,      0,       0, 16, 500,    55,     1000},
244 { "elf",                        5,      8,      1,      0,      0,       0, 15,  50,    22,     35      },
245 { "gelatinous cube",5,  9,      1,      0,      0,       0,  3,   0,    22,     45      },
246
247 { "metamorph",          6,      7,      3,      0,      0,       0,  3,  0,             30,     40      },
248 { "vortex",                     6,      4,      3,      0,      0,       0,  3,  0,             30,     55      },
249 { "ziller",                     6,      15,     3,      0,      0,       0,  3,  0,             30,     35      },
250 { "violet fungi",       6,      12,     3,      0,      0,       0,  3,  0,             38,     100     },
251 { "wraith",                     6,      3,      1,      6,      0,       0,  3,  0,             30,     325     },
252 { "forvalaka",          6,      2,      5,      0,      0,       0,  7,  0,             50,     280     },
253
254 /*      NAME                    LV      AC      DAM     ATT     DEF     GEN INT GOLD    HP      EXP
255 ----------------------------------------------------------------- */
256
257 { "lama nobe",          7,      7,      3,      0,      0,       0,  6,  0,             35,     80      },
258 { "osequip",            7,      4,      3,      16,     0,       0,  4,  0,             35,     100     },
259 { "rothe",                      7,      15,     5,      0,      0,       0,  3,  100,   50,     250     },
260 { "xorn",                       7,      0,      6,      0,      0,       0, 13,  0,             60,     300     },
261 { "vampire",            7,      3,      4,      6,      0,       0, 17,  0,             50,     1000},
262 { "invisible stalker",7,3,      6,      0,      0,       0,  5,  0,             50,     350     },
263
264 { "poltergeist",        8,      1,      4,      0,      0,       0,  3,  0,             50,     450     },
265 { "disenchantress",     8,      3,      0,      9,      0,       0,  3,  0,             50,     500     },
266 { "shambling mound",8,  2,      5,      0,      0,       0,  6,  0,             45,     400     },
267 { "yellow mold",        8,      12,     4,      0,      0,       0,  3,  0,             35,     250     },
268 { "umber hulk",         8,      3,      7,      11,     0,       0, 14,  0,             65,     600     },
269
270 /*      NAME                    LV      AC      DAM     ATT     DEF     GEN INT GOLD    HP      EXP
271 ----------------------------------------------------------------- */
272
273 { "gnome king",         9,      -1,     10,     0,      0,       0, 18,  2000,  100,3000        },
274 { "mimic",                      9,       5,     6,      0,      0,       0,  8,  0,             55,     99              },
275 { "water lord",         9, -10, 15,     7,      0,       0, 20,  0,             150,15000       },
276 { "bronze dragon",      9,       2,     9,      3,      0,       0, 16,  300,   80, 4000        },
277 { "green dragon",       9,       3,     8,      10,     0,       0, 15,  200,   70, 2500        },
278 { "purple worm",        9,      -1,     11,     0,      0,       0,  3,  100,   120,15000       },
279 { "xvart",                      9,      -2,     12,     0,      0,       0, 13,  0,             90,     1000    },
280
281 { "spirit naga",        10, -20,12,     12,     0,       0, 23,  0,             95, 20000       },
282 { "silver dragon",      10,     -1,     12,     3,      0,       0, 20,  700,   100,10000       },
283 { "platinum dragon",10, -5,     15,     13,     0,       0, 22,  1000,  130,24000       },
284 { "green urchin",       10,     -3,     12,     0,      0,       0,  3,  0,             85, 5000        },
285 { "red dragon",         10,     -2,     13,     3,      0,       0, 19,  800,   110,14000       },
286
287 { "type I demon lord",  12,-30, 18,     0,       0,  0, 20,     0,      140,50000       },
288 { "type II demon lord", 13,-30, 18,     0,       0,  0, 21,     0,      160,75000       },
289 { "type III demon lord",14,-30, 18,     0,       0,  0, 22,     0,      180,100000      },
290 { "type IV demon lord", 15,-35, 20,     0,       0,  0, 23,     0,      200,125000      },
291 { "type V demon lord",  16,-40, 22,     0,       0,  0, 24,     0,      220,150000      },
292 { "type VI demon lord", 17,-45, 24,     0,       0,  0, 25,     0,      240,175000      },
293 { "type VII demon lord",18,-70, 27,     6,       0,  0, 26,     0,      260,200000      },
294 { "demon prince",               25,-127,30,     6,       0,  0, 28,     0,      345,300000      }
295
296 /*      NAME                            LV      AC      DAM     ATT     DEF     GEN INT GOLD    HP      EXP
297 --------------------------------------------------------------------- */
298  };
299
300 /*      name array for scrolls          */
301
302 char *scrollname[] = {
303 "\0enchant armor",
304 "\0enchant weapon",
305 "\0enlightenment",
306 "\0blank paper",
307 "\0create monster",
308 "\0create artifact",
309 "\0aggravate monsters",
310 "\0time warp",
311 "\0teleportation",
312 "\0expanded awareness",
313 "\0haste monsters",
314 "\0monster healing",
315 "\0spirit protection",
316 "\0undead protection",
317 "\0stealth",
318 "\0magic mapping",
319 "\0hold monsters",
320 "\0gem perfection",
321 "\0spell extension",
322 "\0identify",
323 "\0remove curse",
324 "\0annihilation",
325 "\0pulverization",
326 "\0life protection",
327 "\0 ",
328 "\0 ",
329 "\0 ",
330 "\0 "
331  };
332
333 /*      name array for magic potions    */
334 char *potionname[] = {
335 "\0sleep",
336 "\0healing",
337 "\0raise level",
338 "\0increase ability",
339 "\0wisdom",
340 "\0strength",
341 "\0raise charisma",
342 "\0dizziness",
343 "\0learning",
344 "\0gold detection",
345 "\0monster detection",
346 "\0forgetfulness",
347 "\0water",
348 "\0blindness",
349 "\0confusion",
350 "\0heroism",
351 "\0sturdiness",
352 "\0giant strength",
353 "\0fire resistance",
354 "\0treasure finding",
355 "\0instant healing",
356 " cure dianthroritis",
357 "\0poison",
358 "\0see invisible",
359 "\0 ",
360 "\0 ",
361 "\0 ",
362 "\0 ",
363 "\0 ",
364 "\0 ",
365 "\0 ",
366 "\0 ",
367 "\0 ",
368 "\0 ",
369 "\0 "
370  };
371
372 \f
373 /*
374         spell data
375  */
376 char spelknow[SPNUM]={0};
377 char splev[] = { 1, 4, 9, 14, 18, 22, 26, 29, 32, 35, 37, 37, 37, 37, 37 };
378
379 char *spelcode[]={
380         "pro",  "mle",  "dex",  "sle",  "chm",  "ssp",
381         "web",  "str",  "enl",  "hel",  "cbl",  "cre",  "pha",  "inv",
382         "bal",  "cld",  "ply",  "can",  "has",  "ckl",  "vpr",
383         "dry",  "lit",  "drl",  "glo",  "flo",  "fgr",
384         "sca",  "hld",  "stp",  "tel",  "mfi", /* 31 */
385         "sph",  "gen",  "sum",  "wtw",  "alt",  "per"
386  };
387
388 char *spelname[]={
389         "protection",                           "magic missile",                "dexterity",
390         "sleep",                                        "charm monster",                "sonic spear",
391
392         "web",                                          "strength",                             "enlightenment",
393         "healing",                                      "cure blindness",               "create monster",
394         "phantasmal forces",            "invisibility",
395
396         "fireball",                                     "cold",                                 "polymorph",
397         "cancellation",                         "haste self",                   "cloud kill",
398         "vaporize rock",
399
400         "dehydration",                          "lightning",                    "drain life",
401         "invulnerability",                      "flood",                                "finger of death",
402
403         "scare monster",                        "hold monster",                 "time stop",
404         "teleport away",                        "magic fire",
405
406         "sphere of annihilation",       "genocide",                             "summon demon",
407         "walk through walls",           "alter reality",                "permanence",
408         ""
409  };
410
411 char *speldescript[]={
412 /* 1 */
413         "generates a +2 protection field",
414         "creates and hurls a magic missile equivalent to a + 1 magic arrow",
415         "adds +2 to the casters dexterity",
416         "causes some monsters to go to sleep",
417         "some monsters may be awed at your magnificence",
418         "causes your hands to emit a screeching sound toward what they point",
419 /* 7 */
420         "causes strands of sticky thread to entangle an enemy",
421         "adds +2 to the casters strength for a short term",
422         "the caster becomes aware of things around him",
423         "restores some hp to the caster",
424         "restores sight to one so unfortunate as to be blinded",
425         "creates a monster near the caster appropriate for the location",
426         "creates illusions, and if believed, monsters die",
427         "the caster becomes invisible",
428 /* 15 */
429         "makes a ball of fire that burns on what it hits",
430         "sends forth a cone of cold which freezes what it touches",
431         "you can find out what this does for yourself",
432         "negates the ability of a monster to use his special abilities",
433         "speeds up the casters movements",
434         "creates a fog of poisonous gas which kills all that is within it",
435         "this changes rock to air",
436 /* 22 */
437         "dries up water in the immediate vicinity",
438         "you finger will emit a lightning bolt when this spell is cast",
439         "subtracts hit points from both you and a monster",
440         "this globe helps to protect the player from physical attack",
441         "this creates an avalanche of H2O to flood the immediate chamber",
442         "this is a holy spell and calls upon your god to back you up",
443 /* 28 */
444         "terrifies the monster so that hopefully he wont hit the magic user",
445         "the monster is frozen in his tracks if this is successful",
446         "all movement in the caverns ceases for a limited duration",
447         "moves a particular monster around in the dungeon (hopefully away from you)",
448         "this causes a curtain of fire to appear all around you",
449 /* 33 */
450         "anything caught in this sphere is instantly killed.  Warning -- dangerous",
451         "eliminates a species of monster from the game -- use sparingly",
452         "summons a demon who hopefully helps you out",
453         "allows the player to walk through walls for a short period of time",
454         "god only knows what this will do",
455         "makes a character spell permanent, i. e. protection, strength, etc.",
456         ""
457  };
458
459 char spelweird[MAXMONST+8][SPNUM] = {
460 /*                      p m d s c s    w s e h c c p i    b c p c h c v    d l d g f f    s h s t m    s g s w a p */
461 /*                      r l e l h s    e t n e b r h n    a l l a a k p    r i r l l g    c l t e f    p e u t l e */
462 /*                      o e x e m p    b r l l l e a v    l d y n s l r    y t l o o r    a d p l i    h n m w t r */
463
464
465 /*            bat */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
466 /*          gnome */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,5,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
467 /*      hobgoblin */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
468 /*         jackal */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
469 /*         kobold */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,5,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
470
471 /*            orc */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   4,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
472 /*          snake */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
473 /*giant centipede */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
474 /*         jaculi */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
475 /*     troglodyte */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
476
477 /*      giant ant */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
478 /*   floating eye */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
479 /*     leprechaun */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
480 /*          nymph */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
481 /*         quasit */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
482
483 /*   rust monster */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   4,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
484 /*         zombie */ {  0,0,0,8,0,4,   0,0,0,0,0,0,0,0,   0,0,0,0,0,4,0,   4,0,0,0,0,4,   0,0,0,0,0,   0,0,0,0,0,0 },
485 /*   assassin bug */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
486 /*        bugbear */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,5,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
487 /*     hell hound */ {  0,6,0,0,0,0,   12,0,0,0,0,0,0,0,  0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
488
489 /*     ice lizard */ {  0,0,0,0,0,0,   11,0,0,0,0,0,0,0,  0,15,0,0,0,0,0,  0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
490 /*        centaur */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
491 /*          troll */ {  0,7,0,0,0,0,   0,0,0,0,0,0,0,5,   0,0,0,0,0,0,0,   4,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
492 /*           yeti */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,15,0,0,0,0,0,  0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
493 /*   white dragon */ {  0,0,0,0,0,0,   0,0,0,0,0,0,14,0,  0,15,0,0,0,0,0,  4,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
494
495 /*            elf */ {  0,0,0,0,0,0,   0,0,0,0,0,0,14,5,  0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
496 /*gelatinous cube */ {  0,0,0,0,0,0,   2,0,0,0,0,0,0,0,   0,0,0,0,0,4,0,   0,0,0,0,0,4,   0,0,0,0,0,   0,0,0,0,0,0 },
497 /*      metamorph */ {  0,13,0,0,0,0,  2,0,0,0,0,0,0,0,   0,0,0,0,0,4,0,   4,0,0,0,0,4,   0,0,0,0,0,   0,0,0,0,0,0 },
498 /*         vortex */ {  0,13,0,0,0,10, 1,0,0,0,0,0,0,0,   0,0,0,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   0,0,0,0,0,0 },
499 /*         ziller */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
500
501 /*   violet fungi */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
502 /*         wraith */ {  0,0,0,8,0,4,   0,0,0,0,0,0,0,0,   0,0,0,0,0,4,0,   4,0,0,0,0,4,   0,0,0,0,0,   0,0,0,0,0,0 },
503 /*      forvalaka */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,5,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
504 /*      lama nobe */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
505 /*        osequip */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
506
507 /*          rothe */ {  0,7,0,0,0,0,   0,0,0,0,0,0,0,5,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
508 /*           xorn */ {  0,7,0,0,0,0,   0,0,0,0,0,0,0,5,   0,0,0,0,0,0,0,   4,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
509 /*        vampire */ {  0,0,0,8,0,4,   0,0,0,0,0,0,0,0,   0,0,0,0,0,4,0,   0,0,0,0,0,4,   0,0,0,0,0,   0,0,0,0,0,0 },
510 /*invisible staker*/ {  0,0,0,0,0,0,   1,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
511 /*    poltergeist */ {  0,13,0,8,0,4,  1,0,0,0,0,0,0,0,   0,4,0,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   0,0,0,0,0,0 },
512
513 /* disenchantress */ {  0,0,0,8,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
514 /*shambling mound */ {  0,0,0,0,0,10,  0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
515 /*    yellow mold */ {  0,0,0,8,0,0,   1,0,0,0,0,0,4,0,   0,0,0,0,0,4,0,   0,0,0,0,0,4,   0,0,0,0,0,   0,0,0,0,0,0 },
516 /*     umber hulk */ {  0,7,0,0,0,0,   0,0,0,0,0,0,0,5,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
517 /*     gnome king */ {  0,7,0,0,3,0,   0,0,0,0,0,0,0,5,   0,0,9,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
518
519 /*          mimic */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
520 /*     water lord */ {  0,13,0,8,3,4,  1,0,0,0,0,0,0,0,   0,0,9,0,0,4,0,   0,0,0,0,16,4,  0,0,0,0,0,   0,0,0,0,0,0 },
521 /*  bronze dragon */ {  0,7,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
522 /*   green dragon */ {  0,7,0,0,0,0,   11,0,0,0,0,0,0,0,  0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
523 /*    purple worm */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
524
525 /*          xvart */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
526 /*    spirit naga */ {  0,13,0,8,3,4,  1,0,0,0,0,0,0,5,   0,4,9,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   0,0,0,0,0,0 },
527 /*  silver dragon */ {  0,6,0,9,0,0,   12,0,0,0,0,0,0,0,  0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
528 /*platinum dragon */ {  0,7,0,9,0,0,   11,0,0,0,0,0,14,0, 0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
529 /*   green urchin */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
530 /*     red dragon */ {  0,6,0,0,0,0,   12,0,0,0,0,0,0,0,  0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
531
532 /*                      p m d s c s    w s e h c c p i    b c p c h c v    d l d g f f    s h s t m    s g s w a p */
533 /*                      r l e l h s    e t n e b r h n    a l l a a k p    r i r l l g    c l t e f    p e u t l e */
534 /*                      o e x e m p    b r l l l e a v    l d y n s l r    y t l o o r    a d p l i    h n m w t r */
535
536 /*     demon lord */ {  0,7,0,4,3,0,   1,0,0,0,0,0,14,5,  0,0,4,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   9,0,0,0,0,0 },
537 /*     demon lord */ {  0,7,0,4,3,0,   1,0,0,0,0,0,14,5,  0,0,4,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   9,0,0,0,0,0 },
538 /*     demon lord */ {  0,7,0,4,3,0,   1,0,0,0,0,0,14,5,  0,0,4,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   9,0,0,0,0,0 },
539 /*     demon lord */ {  0,7,0,4,3,0,   1,0,0,0,0,0,14,5,  0,0,4,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   9,0,0,0,0,0 },
540 /*     demon lord */ {  0,7,0,4,3,0,   1,0,0,0,0,0,14,5,  0,0,4,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   9,0,0,0,0,0 },
541 /*     demon lord */ {  0,7,0,4,3,0,   1,0,0,0,0,0,14,5,  0,0,4,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   9,0,0,0,0,0 },
542 /*     demon lord */ {  0,7,0,4,3,0,   1,0,0,0,0,0,14,5,  0,0,4,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   9,0,0,0,0,0 },
543 /*   demon prince */ {  0,7,0,4,3,9,   1,0,0,0,0,0,14,5,  0,0,4,0,0,4,0,   4,0,0,0,4,4,   4,0,0,0,4,   9,0,0,0,0,0 }
544
545  };
546
547 char *spelmes[] = { "",
548 /*  1 */        "the web had no effect on the %s",
549 /*  2 */        "the %s changed shape to avoid the web",
550 /*  3 */        "the %s isn't afraid of you",
551 /*  4 */        "the %s isn't affected",
552 /*  5 */        "the %s can see you with his infravision",
553 /*  6 */        "the %s vaporizes your missile",
554 /*  7 */        "your missile bounces off the %s",
555 /*  8 */        "the %s doesn't sleep",
556 /*  9 */        "the %s resists",
557 /* 10 */        "the %s can't hear the noise",
558 /* 11 */        "the %s's tail cuts it free of the web",
559 /* 12 */        "the %s burns through the web",
560 /* 13 */        "your missiles pass right through the %s",
561 /* 14 */        "the %s sees through your illusions",
562 /* 15 */        "the %s loves the cold!",
563 /* 16 */        "the %s loves the water!"
564  };
565
566 char to_lower[]= /* tolower[character] = lower case converted character */
567     {
568     0000,0001,0002,0003,0004,0005,0006,0007,0010,0011,0012,0013,0014,0015,0016,0017, /* NUL-SI*/
569     0020,0021,0022,0023,0024,0025,0026,0027,0030,0031,0032,0033,0034,0035,0036,0037, /* DLE-US*/
570     0040,0041,0042,0043,0044,0045,0046,0047,0050,0051,0052,0053,0054,0055,0056,0057, /* SP-/ */
571     0060,0061,0062,0063,0064,0065,0066,0067,0070,0071,0072,0073,0074,0075,0076,0077, /* 0-? */
572     0100,0141,0142,0143,0144,0145,0146,0147,0150,0151,0152,0153,0154,0155,0156,0157, /* @-O */
573     0160,0161,0162,0163,0164,0165,0166,0167,0170,0171,0172,0133,0134,0135,0136,0137, /* P-_ */
574     0140,0141,0142,0143,0144,0145,0146,0147,0150,0151,0152,0153,0154,0155,0156,0157, /* `-o */
575     0160,0161,0162,0163,0164,0165,0166,0167,0170,0171,0172,0173,0174,0175,0176,0177, /* p-DEL */
576     };
577
578 char to_upper[]= /* toupper[character] = upper case converted character */
579     {
580     0000,0001,0002,0003,0004,0005,0006,0007,0010,0011,0012,0013,0014,0015,0016,0017, /* NUL-SI*/
581     0020,0021,0022,0023,0024,0025,0026,0027,0030,0031,0032,0033,0034,0035,0036,0037, /* DLE-US*/
582     0040,0041,0042,0043,0044,0045,0046,0047,0050,0051,0052,0053,0054,0055,0056,0057, /* SP-/ */
583     0060,0061,0062,0063,0064,0065,0066,0067,0070,0071,0072,0073,0074,0075,0076,0077, /* 0-? */
584     0100,0101,0102,0103,0104,0105,0106,0107,0110,0111,0112,0113,0114,0115,0116,0117, /* @-O */
585     0120,0121,0122,0123,0124,0125,0126,0127,0130,0131,0132,0133,0134,0135,0136,0137, /* P-_ */
586     0140,0101,0102,0103,0104,0105,0106,0107,0110,0111,0112,0113,0114,0115,0116,0117, /* `-o */
587     0120,0121,0122,0123,0124,0125,0126,0127,0130,0131,0132,0173,0174,0175,0176,0177, /* p-DEL */
588     };
589
590 char is_digit[]=  /* isdigit[character] = TRUE || FALSE */
591     {
592     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* NUL-SI*/
593     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* DLE-US*/
594     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* SP-/ */
595     1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, /* 0-? */
596     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* @-O */
597     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* P-_ */
598     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* `-o */
599     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* p-DEL */
600     };
601
602 char is_alpha[]=  /* isalpha[character] = TRUE || FALSE */
603     {
604     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* NUL-SI*/
605     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* DLE-US*/
606     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* SP-/ */
607     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0-? */
608     0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* @-O */
609     1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* P-_ */
610     0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* `-o */
611     1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* p-DEL */
612     };
613
614 /*
615  *      function to create scroll numbers with appropriate probability of
616  *      occurrence
617  *
618  *      0 - armor                       1 - weapon              2 - enlightenment       3 - paper
619  *      4 - create monster      5 - create item 6 - aggravate           7 - time warp
620  *      8 - teleportation       9 - expanded awareness                          10 - haste monst
621  *      11 - heal monster       12 - spirit protection          13 - undead protection
622  *      14 - stealth            15 - magic mapping                      16 - hold monster
623  *      17 - gem perfection 18 - spell extension                19 - identify
624  *      20 - remove curse       21 - annihilation                       22 - pulverization
625  *  23 - life protection
626  */
627 char scprob[]= { 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3,
628         3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9,
629         9, 9, 10, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14,
630         15, 15, 16, 16, 16, 17, 17, 18, 18, 19, 19, 19, 20, 20, 20, 20, 21, 22,
631         22, 22, 23 };
632
633 /*
634  *      function to return a potion number created with appropriate probability
635  *      of occurrence
636  *
637  *      0 - sleep                               1 - healing                                     2 - raise level
638  *      3 - increase ability    4 - gain wisdom                         5 - gain strength
639  *      6 - charismatic character       7 - dizziness                   8 - learning
640  *      9 - gold detection              10 - monster detection          11 - forgetfulness
641  *      12 - water                              13 - blindness                          14 - confusion
642  *      15 - heroism                    16 - sturdiness                         17 - giant strength
643  *      18 - fire resistance    19 - treasure finding           20 - instant healing
644  *      21 - cure dianthroritis 22 - poison                                     23 - see invisible
645  */
646 char potprob[] = { 0, 0, 1, 1, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 9, 9, 9, 10, 10, 10, 11, 11, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 20, 22, 22, 23, 23 };
647
648 char nlpts[] = { 0, 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7 };
649 char nch[] = { 0, 0, 0, 1, 1, 1, 2, 2, 3, 4 };
650 char nplt[] = { 0, 0, 0, 0, 1, 1, 2, 2, 3, 4 };
651 char ndgg[] = { 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 4, 5 };
652 char nsw[] = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 3 };