1 /* 2 * Copyright (c) 1983 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 char copyright[] = 20 "@(#) Copyright (c) 1983 Regents of the University of California.\n\ 21 All rights reserved.\n"; 22 #endif /* not lint */ 23 24 #ifndef lint 25 static char sccsid[] = "@(#)battlestar.c 5.2 (Berkeley) 06/19/88"; 26 #endif /* not lint */ 27 28 /* 29 * Battlestar - a stellar-tropical adventure game 30 * 31 * Originally written by His Lordship, Admiral David W. Horatio Riggle, 32 * on the Cory PDP-11/70, University of California, Berkeley. 33 */ 34 35 #include "externs.h" 36 37 main(argc,argv) 38 int argc; 39 char **argv; 40 { 41 char mainbuf[LINELENGTH]; 42 char *next; 43 44 initialize(argc < 2 || strcmp(argv[1], "-r")); 45 start: 46 news(); 47 beenthere[position]++; 48 if (notes[LAUNCHED]) 49 crash(); /* decrements fuel & crash */ 50 if (matchlight) { 51 puts("Your match splutters out."); 52 matchlight = 0; 53 } 54 if (!notes[CANTSEE] || testbit(inven,LAMPON) || 55 testbit(location[position].objects, LAMPON)) { 56 writedes(); 57 printobjs(); 58 } else 59 puts("It's too dark to see anything in here!"); 60 whichway(location[position]); 61 run: 62 next = getcom(mainbuf, sizeof mainbuf, ">-: ", 63 "Please type in something."); 64 for (wordcount = 0; next && wordcount < 20; wordcount++) 65 next = getword(next, words[wordcount], -1); 66 parse(); 67 switch (cypher()) { 68 case -1: 69 goto run; 70 case 0: 71 goto start; 72 default: 73 exit(); 74 } 75 } 76