Example #1
0
void main(void) {
	int key;
	intro();
	clrscr();
	gotoxy(35, 1);
	puts("Shooter97!");
	NextBFire = (random(289)+11);
	do {
		DrawWorld();
		if (!Hits()) {
		delay(75);
		BFireCount++;
		if (((BFireCount % NextBFire) == 0) && (!BFire)) {
			BFire = 1;
			BFireXPos = bgpos;
			NextBFire = (random(289)+11);
		}
		if (kbhit()) {
			key = getch();
			if (key == 0) {
				key = getch();
			}
			if (key == 75) {
				ggdir = -1;
			}
			if (key == 77) {
				ggdir = 1;
			}
			if ((key == 72) && (!GFire)) {
				GFire = 1;
				GFireXPos = ggpos;
			}
			if ((key == 113) || (key == 81)) {
				/* then die */
				dead = 1;
			}
		} /* end of if kb hit */
		} /* end of nobody got hit */
	} while (!dead);
	clrscr();
	switch (Hits()) {
		case -1 : {
				puts(" ");
				puts("The BadGuy shot you! GAME OVER!");
				break;
				}
		case 1 : {
				puts(" ");
				puts("You shot the BadGuy! YOU WIN!");
				break;
				}
	}
	puts(" ");
	puts("Thank you for playing Shooter97!");
}
Example #2
0
Hits Searcher::getHits(const string& term) {
    int size;
    char *val;
    try {
      val = depot.get(term.c_str(), -1, 0, -1, &size);
    } catch(Depot_error& e){
      //cerr << e << endl;
      return Hits(NULL, 0);
    }
    Node* nodes = (Node*) val;
    int num = size / sizeof(Node);

    if(isCompressed())
      nodes = gammaHits(val, size, num);

    return Hits(nodes, num);
}