1 /*
2  * Copyright (c) 1983 Regents of the University of California,
3  * All rights reserved.  Redistribution permitted subject to
4  * the terms of the Berkeley Software License Agreement.
5  */
6 
7 #ifndef lint
8 static char sccsid[] = "@(#)battlestar.c	1.3 04/24/85";
9 #endif
10 
11 /*
12  * Battlestar - a stellar-tropical adventure game
13  *
14  * Originally written by His Lordship, Admiral David W. Horatio Riggle,
15  * on the Cory PDP-11/70, University of California, Berkeley.
16  */
17 
18 #include "externs.h"
19 
20 main(argc,argv)
21 int  argc;
22 char **argv;
23 {
24 	char mainbuf[LINELENGTH];
25 	char *next;
26 
27 	initialize(argc < 2 || strcmp(argv[1], "-r"));
28 start:
29 	news();
30 	beenthere[position]++;
31 	if (notes[LAUNCHED])
32 		crash();		/* decrements fuel & crash */
33 	if (matchlight) {
34 		puts("Your match splutters out.");
35 		matchlight = 0;
36 	}
37 	if (!notes[CANTSEE] || testbit(inven,LAMPON) ||
38 	    testbit(location[position].objects, LAMPON)) {
39 		writedes();
40 		printobjs();
41 	} else
42 		puts("It's too dark to see anything in here!");
43 	whichway(location[position]);
44 run:
45 	next = getcom(mainbuf, sizeof mainbuf, ">-: ",
46 		"Please type in something.");
47 	for (wordcount = 0; next && wordcount < 20; wordcount++)
48 		next = getword(next, words[wordcount], -1);
49 	parse();
50 	switch (cypher()) {
51 		case -1:
52 			goto run;
53 		case 0:
54 			goto start;
55 		default:
56 			exit();
57 	}
58 }
59