Пример #1
0
int winmine() {
    int x,y;
    win_showrec();
    clear();
    refresh();
    while(1) {
		totallei=0;//add by stiger
		stiger=0;//add by stiger
		steps=0;//add by stiger
        opened=0;
        clear();
        for (x=0;x<=31;x++)
        for (y=0;y<=17;y++) {
             a[x][y]= 0;
             m[x][y]= 0;
             f[x][y]= 0;//add by stiger
//             o[x][y]= 0;
//
             if(x==0||x==31||y==0||y==17) o[x][y]= 1;
             	else o[x][y]=0;
        }
        winrefresh();
        if(winloop()==0) break;
        pressanykey();
    }
    return 0;
}
Пример #2
0
void
win_sort()
{
	int n, n2, tmp;
	char tmpID[NUMREC];
	for (n = 0; n < NUMREC - 1; n++) {
		for (n2 = n + 1; n2 < NUMREC; n2++)
			if (topStage[n] < topStage[n2] ||
			    (topStage[n] == topStage[n2] &&
			     topSteps[n] > topSteps[n2])) {
				strcpy(tmpID, topID[n]);
				strcpy(topID[n], topID[n2]);
				strcpy(topID[n2], tmpID);
				tmp = topStage[n];
				topStage[n] = topStage[n2];
				topStage[n2] = tmp;
				tmp = topSteps[n];
				topSteps[n] = topSteps[n2];
				topSteps[n2] = tmp;
				strcpy(tmpID, topFROM[n]);
				strcpy(topFROM[n], topFROM[n2]);
				strcpy(topFROM[n2], tmpID);
				strcpy(tmpID, prize[n]);
				strcpy(prize[n], prize[n2]);
				strcpy(prize[n2], tmpID);
			}
	}
	win_saverec();
	clear();
	printf("×£ºØ£¡ÄúË¢ÐÂÁË×Ô¼ºµÄ¼Í¼£¡\r\n");
	pressanykey();
	win_showrec();
}
Пример #3
0
void
win_sort()
{
	int n, n2, tmp;
	char tmpID[sizeof(topID[0])];
	for (n = 0; n <= 18; n++) {
		for (n2 = n + 1; n2 <= 19; n2++) {
			if (topT[n] > topT[n2]) {
				tmp = topT[n];
				topT[n] = topT[n2];
				topT[n2] = tmp;
				strcpy(tmpID, topID[n]);
				strcpy(topID[n], topID[n2]);
				strcpy(topID[n2], tmpID);
				strcpy(tmpID, topFROM[n]);
				strcpy(topFROM[n], topFROM[n2]);
				strcpy(topFROM[n2], tmpID);
				strcpy(tmpID, prize[n]);
				strcpy(prize[n], prize[n2]);
				strcpy(prize[n2], tmpID);
			}
		}
	}
	win_saverec();
	clear();
	prints("×£ºØ! ÄúË¢ÐÂÁË×Ô¼ºµÄ¼Í¼!\r\n");
	pressanykey();
	win_showrec();
}
Пример #4
0
int winmine() {
    int x,y;
    win_showrec();
    screen_clear();
    refresh();
    while(1) {
        screen_clear();
        for (x=0;x<=31;x++)
        for (y=0;y<=17;y++) {
             a[x][y]= 0;
             m[x][y]= 0;
             o[x][y]= 0;
        }
        winrefresh();
        winloop();
        pressanykey();
    }
}
Пример #5
0
void
winmine()
{
	int x, y;
	win_showrec();
	clear();
	prints("Enable ANSI color?[Y/N]");
	refresh();
	if (strchr("Nn", egetch()))
		colorful = 0;
	while (1) {
		clear();
		for (x = 0; x <= 31; x++)
			for (y = 0; y <= 17; y++) {
				a[x][y] = 0;
				m[x][y] = 0;
				o[x][y] = 0;
			}
		winrefresh();
		winloop();
		pressanykey();
	}
}
Пример #6
0
int
main(int n, char *cmd[])
{
	int c, m, i;
	int dx, dy;

	telnet_init();
	if (map_init() == 0)
		printf("map.dat error\n");
	if (n >= 2) {
		char buf[40];
		strsncpy(userid, cmd[1], sizeof (userid));
		readuservalue(userid, "worker.laststage", buf, sizeof (buf));
		lastMaxStage = atoi(buf);
		if (lastMaxStage >= map_total)
			lastMaxStage = map_total - 1;
		stage = lastMaxStage;
	}
	if (n >= 3)
		strsncpy(fromhost, cmd[2], sizeof (fromhost));

	if (stage == 0) {
		clear();
		printf("»¶Ó­¹âÁÙÍÆÏä×ÓÓÎÏ·¡£\r\n");
		printf
		    ("¹æÔòºÜ¼òµ¥£¬Ö»Ðè°ÑËùÓеÄ'¡õ'¶¼ÍƵ½'¡¤'ÉÏÃæÈ¥(»á±ä³ÉÂÌÉ«)¾Í¹ý¹ØÁË¡£\r\n");
		printf("µ«ÍæÆðÀ´ÄѶȿÉÊÇÏ൱´óµÄ£¬²»ÒªÇáÊÓม£\r\n");
		pressanykey();
		goto start;
	}

	win_showrec();
	clear();

	printf("ÇëÓ÷½Ïò¼üÑ¡¹Ø, »Ø³µ¼üÈ·ÈÏ: %d ", stage);
	move(0, 14);
	while (1) {
		c = inkey();
		if ((c == KEY_LEFT || c == KEY_UP) && stage > 0)
			stage--;
		if ((c == KEY_RIGHT || c == KEY_DOWN) && stage < lastMaxStage)
			stage++;
		if (c == 10 || c == 13)
			break;
		if (c == 3 || c == 4 || c == 32)
			quit();
		move(0, 14);
		printf("%d  ", stage);
		move(0, 14);
	}

      start:
	if (stage < 0 || stage >= map_total)
		stage = 0;
	clear();
	printf("ÍÆÏä×Ó: µÚ %d ¹Ø:\033[m", stage);
	move(20, 0);
	refresh();
	sleep(1);
      start2:
	for (n = 0; n < 20; n++)
		for (m = 0; m < 30; m++)
			map_now[n][m] = map_data[stage][n][m];
	if (!find_y_x(&now_y, &now_x))
		printf("stage error\n");
	map_show();
	bzero(&my_history, sizeof (my_history));
	while (1) {
		c = inkey();
		if (my_history.max >= 1999) {
			move(21, 0);
			printf("ÄãÓÃÁË2000²½»¹Ã»Óйý¹Ø! GAME OVER.");
			quit();
		}
		dx = 0;
		dy = 0;
		if (c == 8 && my_history.max > 0) {
			my_history.max--;
			i = my_history.max;
			map_move(my_history.y1[i], my_history.x1[i],
				 my_history.y0[i], my_history.x0[i]);
			find_y_x(&now_y, &now_x);
			move(now_y, now_x);
			continue;
		}

		if (c == ' ')
			quit();
		if (c == '')
			map_show();
		if (c == 9)
			goto start2;

		if (c == KEY_UP)
			dy = -1;
		if (c == KEY_DOWN)
			dy = 1;
		if (c == KEY_LEFT)
			dx = -1;
		if (c == KEY_RIGHT)
			dx = 1;

		if (dx == 0 && dy == 0)
			continue;

		if (map_now[now_y + dy][now_x + dx] & 4)
			if (map_now[now_y + dy * 2][now_x + dx * 2] < 2) {
				map_move(now_y + dy, now_x + dx, now_y + dy * 2,
					 now_x + dx * 2);
				i = my_history.max;
				my_history.y0[i] = now_y + dy;
				my_history.x0[i] = now_x + dx;
				my_history.y1[i] = now_y + dy * 2;
				my_history.x1[i] = now_x + dx * 2;
				my_history.max++;
			}
		if (map_now[now_y + dy][now_x + dx] < 2) {
			map_move(now_y, now_x, now_y + dy, now_x + dx);
			i = my_history.max;
			my_history.y0[i] = now_y;
			my_history.x0[i] = now_x;
			my_history.y1[i] = now_y + dy;
			my_history.x1[i] = now_x + dx;
			my_history.max++;
		}
		if (check_if_win())
			break;
		find_y_x(&now_y, &now_x);
		move(now_y, now_x);
	}
	move(19, 0);
	printf("×£ºØÄã, Äã³É¹¦ÁË£¡");
	steps = my_history.max;
	win_checkrec();

	stage++;
	if (stage > lastMaxStage) {
		lastMaxStage = stage;
		if (strcmp(userid, "null.")) {
			char buf[30];
			sprintf(buf, "%d", lastMaxStage);
			saveuservalue(userid, "worker.laststage", buf);
		}
	}
	goto start;
}