好玩的枪战

蒙青创 尹治达  •  1年前


include

include

include <windows.h>

include <conio.h>

using namespace std; int SIZ = 20; HANDLE hout = GetStdHandle(STD_OUTPUT_HANDLE); COORD coord; HANDLE hCon;

enum Color { DARKBLUE = 1, DARKGREEN, DARKTEAL, DARKRED, DARKPINK, DARKYELLOW, GRAY, DARKGRAY, BLUE, GREEN, TEAL, RED, PINK, YELLOW, WHITE };

void SetColor(Color c) {

if (hCon == NULL)
	hCon = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hCon, c);

} SYSTEMTIME sys;

//sys.wYear,sys.wMonth,sys.wDay,sys.wHour,sys.wMinute, sys.wSecond,sys.wMilliseconds,sys.wDayOfWeek struct PLAYER {

int x, y;
int hp;
int gun;
int direct;

} p1, p2; int map[1005][1005];

int abs(int x) {

if (x < 0)
	return -x;
return x;

}

void locate(int x, int y) {

coord.X = y - 1;
coord.Y = x - 1;
SetConsoleCursorPosition(hout, coord);

}

void print_map() {

locate(1, 1);
SetColor(GRAY);
for (int i = 1; i <= SIZ; i++)
	cout << "■";
locate(SIZ, 1);
for (int i = 1; i <= SIZ; i++)
	cout << "■";
for (int i = 2; i < SIZ; i++) {
	locate(i, 1);
	cout << "■";
	locate(i, SIZ * 2 - 1);
	cout << "■";
}
locate(SIZ + 1, 1);
SetColor(WHITE);

}

void create_tree(int x, int y) {

map[x][y] = map[x + 1][y] = map[x - 1][y] = map[x][y + 1] = map[x][y - 1] = 2;

}

void use_map(int x) {

if (x == 1) {
	SIZ = 20;
	SetColor(DARKGREEN);
	map[16][6] = map[15][6] = map[17][6] = map[16][7] = map[16][5] = map[14][13] = map[13][12] = map[13][13] = 2;
	for (int i = 2; i < SIZ; i++) {
		for (int j = 2; j < SIZ; j++) {
			if (map[i][j] == 2) {
				locate(i, j * 2 - 1);
				cout << "■";
			}
		}
	}
	SetColor(GRAY);
	for (int i = 5; i <= 15; i++) {
		map[i][i] = 1;
		locate(i, i * 2 - 1);
		cout << "■";
	}
	SetColor(WHITE);
} else if (x == 2) {
	SIZ = 30;
	SetColor(GRAY);
	for (int i = 4; i <= 26; i++) {
		if (i == 13 || i == 14 || i == 15)
			continue;
		map[i][4] = map[4][i] = map[26][i] = map[i][26] = 1;
	}
	for (int i = 1; i <= SIZ; i++) {
		for (int j = 1; j <= SIZ; j++) {
			if (map[i][j] == 1) {
				locate(i, j * 2 - 1);
				cout << "■";
			}
		}
	}
	SetColor(DARKGREEN);
	for (int i = 10; i <= 20; i++) {
		if (i == 13 || i == 17)
			continue;
		map[i][10] = map[10][i] = map[20][i] = map[i][20] = 2;
	}
	create_tree(5, 5);
	create_tree(18, 18);
	for (int i = 1; i <= SIZ; i++) {
		for (int j = 1; j <= SIZ; j++) {
			if (map[i][j] == 2) {
				locate(i, j * 2 - 1);
				cout << "■";
			}
		}
	}
	SetColor(WHITE);
}

} void cleanbody(int x, int y); void putbody(int x, int y, int z);

void player_init() {

p1.hp = p2.hp = 300;
p1.gun = p2.gun = 1;
p1.direct = 4;
p2.direct = 2;
p1.x = 2;
p1.y = 2;
p2.x = SIZ - 1;
p2.y = SIZ - 1;
putbody(p1.x, p1.y, 1);
putbody(p2.x, p2.y, 2);

}

void mapinit() {

for (int i = 1; i <= SIZ; i++) {
	map[i][1] = map[1][i] = map[SIZ][i] = map[i][SIZ] = 1;
}

}

void init() {

printf("Use Which Map?\n");
int x;
cin >> x;
system("cls");
use_map(x);
mapinit();
print_map();
player_init();

}

void putbody(int x, int y, int z) {

if (z == 1)
	SetColor(BLUE);
else if (z == 2)
	SetColor(RED);
locate(x, y * 2 - 1);
cout << "■";
SetColor(WHITE);

}

void cleanbody(int x, int y) {

locate(x, y * 2 - 1);
cout << " ";

}

/* LIST direct:

w 1
a 2
s 3
d 4

gun:

usp 1
mimigun 2
awp 3

block:

void 0
stone 1
tree 2
player 3
clip 4

*/ bool judge(int x, int y) {

if (map[x][y] == 1)
	return false;
if (map[x][y] == 2)
	return false;
if (map[x][y] == 3)
	return false;
return true;

}

bool judge_gun(int x, int y) {

if (map[x][y] == 1)
	return 0;
if (map[x][y] == 2)
	return 0;
if (map[x][y] == 3) {
	if (p1.x == x && p1.y == y)
		p1.hp -= 50;//此处暂时不管威力
	else
		p2.hp -= 50;
	return 0;
}
return 1;

} int cnt;

struct Clip {

int x, y;
int derect;
int force;
int start;
bool flag;

} clip[1000000];

void create_clip(int y, int x, int a, int b) {

int X, Y;
if (y == 1) {
	if (!judge_gun(a - 1, b))
		return;
	X = a - 1;
	Y = b;
} else if (y == 2) {
	if (!judge_gun(a, b - 1))
		return;
	X = a;
	Y = b - 1;
} else if (y == 3) {
	if (!judge_gun(a + 1, b))
		return;
	X = a + 1;
	Y = b;
} else if (y == 4) {
	if (!judge_gun(a, b + 1))
		return;
	X = a;
	Y = b + 1;
}
cnt++;
GetLocalTime( &sys );
clip[cnt].start = sys.wMilliseconds + sys.wSecond * 60 + sys.wHour * 3600;
clip[cnt].x = X;
clip[cnt].y = Y;
if (x == 1) {
	clip[cnt].derect = p1.direct;
} else if (x == 2) {
	clip[cnt].derect = p2.direct;
}

}

void shoot(int x) {

if (x == 1) {
	create_clip(p1.direct, 1, p1.x, p1.y);
} else if (x == 2) {
	create_clip(p2.direct, 2, p2.x, p2.y);
}

}

void clean_clip(int x, int y) {

locate(x, y * 2 - 1);
cout << "  ";
locate(1, 1);

}

void print_clip(int x, int y, int i) {

if (clip[i].flag) {
	clean_clip(x, y);
	return;
}
locate(x, y * 2 - 1);
SetColor(YELLOW);
cout << "''";
locate(1, 1);

// system("pause"); }

void clipmove() {

GetLocalTime( &sys );
int t = sys.wMilliseconds + sys.wSecond * 60 + sys.wHour * 3600;
for (int i = 1; i <= cnt; i++) {
	if (clip[i].flag)
		continue;
	if (abs(clip[i].start - t) > 50) {
		clip[i].start = t;
		int x = clip[i].x;
		int y = clip[i].y;
		if (clip[i].derect == 1) {
			if (!judge_gun(clip[i].x - 1, clip[i].y)) {
				clip[i].flag = 1;
				clean_clip(x, y);
				continue;
			}
			clean_clip(clip[i].x, clip[i].y);
			clip[i].x--;
			print_clip(clip[i].x, clip[i].y, i);
		} else if (clip[i].derect == 2) {
			if (!judge_gun(clip[i].x, clip[i].y - 1)) {
				clip[i].flag = 1;
				clean_clip(x, y);
				continue;
			}
			clean_clip(clip[i].x, clip[i].y);
			clip[i].y--;
			print_clip(clip[i].x, clip[i].y, i);
		} else if (clip[i].derect == 3) {
			if (!judge_gun(clip[i].x + 1, clip[i].y)) {
				clip[i].flag = 1;
				clean_clip(x, y);
				continue;
			}
			clean_clip(clip[i].x, clip[i].y);
			clip[i].x++;
			print_clip(clip[i].x, clip[i].y, i);
		} else if (clip[i].derect == 4) {
			if (!judge_gun(clip[i].x, clip[i].y + 1)) {
				clip[i].flag = 1;
				clean_clip(x, y);
				continue;
			}
			clean_clip(clip[i].x, clip[i].y);
			clip[i].y++;
			print_clip(clip[i].x, clip[i].y, i);
		}
	}
}

}

void judge_hp() {

int x = p1.hp;
int y = p2.hp;
if (x < 0 && y < 0 && x > y)
	swap(x, y);
if (x <= 0) {
	locate(1, 1);
	system("cls");
	printf("GAME OVER!\nTHE WINNER IS P2!");
	Sleep(5000);
	printf("\n-MADE BY Floatiy-");
	exit(0);
} else if (y <= 0) {
	locate(1, 1);
	system("cls");
	printf("GAME OVER!\nTHE WINNER IS P1!");
	Sleep(5000);
	printf("\n-MADE BY Floatiy-");
	exit(0);
}

}

void prog() {

char ch;
while (true) {
	if (kbhit()) {
		ch = getch();
		if (ch == 'w' && judge(p1.x - 1, p1.y)) {
			p1.direct = 1;
			cleanbody(p1.x, p1.y);
			map[p1.x][p1.y] = 0;
			putbody(--p1.x, p1.y, 1);
			map[p1.x][p1.y] = 3;
		} else if (ch == 'o' && judge(p2.x - 1, p2.y)) {
			p2.direct = 1;
			cleanbody(p2.x, p2.y);
			map[p2.x][p2.y] = 0;
			putbody(--p2.x, p2.y, 2);
			map[p2.x][p2.y] = 3;
		} else if (ch == 'a' && judge(p1.x, p1.y - 1)) {
			p1.direct = 2;
			cleanbody(p1.x, p1.y);
			map[p1.x][p1.y] = 0;
			putbody(p1.x, --p1.y, 1);
			map[p1.x][p1.y] = 3;
		} else if (ch == 'k' && judge(p2.x, p2.y - 1)) {
			p2.direct = 2;
			cleanbody(p2.x, p2.y);
			map[p2.x][p2.y] = 0;
			putbody(p2.x, --p2.y, 2);
			map[p2.x][p2.y] = 3;
		} else if (ch == 's' && judge(p1.x + 1, p1.y)) {
			p1.direct = 3;
			cleanbody(p1.x, p1.y);
			map[p1.x][p1.y] = 0;
			putbody(++p1.x, p1.y, 1);
			map[p1.x][p1.y] = 3;
		} else if (ch == 'l' && judge(p2.x + 1, p2.y)) {
			p2.direct = 3;
			cleanbody(p2.x, p2.y);
			map[p2.x][p2.y] = 0;
			putbody(++p2.x, p2.y, 2);
			map[p2.x][p2.y] = 3;
		} else if (ch == 'd' && judge(p1.x, p1.y + 1)) {
			p1.direct =  4;
			cleanbody(p1.x, p1.y);
			map[p1.x][p1.y] = 0;
			putbody(p1.x, ++p1.y, 1);
			map[p1.x][p1.y] = 3;
		} else if (ch == ';' && judge(p2.x, p2.y + 1)) {
			p2.direct = 4;
			cleanbody(p2.x, p2.y);
			map[p2.x][p2.y] = 0;
			putbody(p2.x, ++p2.y, 2);
			map[p2.x][p2.y] = 3;
		} else if (ch == '/') {
			shoot(2);
		} else if (ch == ' ') {
			shoot(1);
		}
		Sleep(20);
	}
	clipmove();
	judge_hp();
}

}

void welcome() {

printf("操作方法:\n玩家1 wasd控制移动,空格攻击 只能往右侧打子弹\n玩家2 数字小键盘4568控制移动,0攻击 只能往左侧打子弹\n");
Sleep(2000);

}

int main() {

welcome();
GetLocalTime( &sys );
init();
prog();
return 0;

}


评论:

include

include

include <windows.h>

include <conio.h>

using namespace std; int SIZ = 20; HANDLE hout = GetStdHandle(STD_OUTPUT_HANDLE); COORD coord; HANDLE hCon;

enum Color { DARKBLUE = 1, DARKGREEN, DARKTEAL, DARKRED, DARKPINK, DARKYELLOW, GRAY, DARKGRAY, BLUE, GREEN, TEAL, RED, PINK, YELLOW, WHITE };

void SetColor(Color c) {

if (hCon == NULL)
	hCon = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hCon, c);

} SYSTEMTIME sys;

//sys.wYear,sys.wMonth,sys.wDay,sys.wHour,sys.wMinute, sys.wSecond,sys.wMilliseconds,sys.wDayOfWeek struct PLAYER {

int x, y;
int hp;
int gun;
int direct;

} p1, p2; int map[1005][1005];

int abs(int x) {

if (x < 0)
	return -x;
return x;

}

void locate(int x, int y) {

coord.X = y - 1;
coord.Y = x - 1;
SetConsoleCursorPosition(hout, coord);

}

void print_map() {

locate(1, 1);
SetColor(GRAY);
for (int i = 1; i <= SIZ; i++)
	cout << "■";
locate(SIZ, 1);
for (int i = 1; i <= SIZ; i++)
	cout << "■";
for (int i = 2; i < SIZ; i++) {
	locate(i, 1);
	cout << "■";
	locate(i, SIZ * 2 - 1);
	cout << "■";
}
locate(SIZ + 1, 1);
SetColor(WHITE);

}

void create_tree(int x, int y) {

map[x][y] = map[x + 1][y] = map[x - 1][y] = map[x][y + 1] = map[x][y - 1] = 2;

}

void use_map(int x) {

if (x == 1) {
	SIZ = 20;
	SetColor(DARKGREEN);
	map[16][6] = map[15][6] = map[17][6] = map[16][7] = map[16][5] = map[14][13] = map[13][12] = map[13][13] = 2;
	for (int i = 2; i < SIZ; i++) {
		for (int j = 2; j < SIZ; j++) {
			if (map[i][j] == 2) {
				locate(i, j * 2 - 1);
				cout << "■";
			}
		}
	}
	SetColor(GRAY);
	for (int i = 5; i <= 15; i++) {
		map[i][i] = 1;
		locate(i, i * 2 - 1);
		cout << "■";
	}
	SetColor(WHITE);
} else if (x == 2) {
	SIZ = 30;
	SetColor(GRAY);
	for (int i = 4; i <= 26; i++) {
		if (i == 13 || i == 14 || i == 15)
			continue;
		map[i][4] = map[4][i] = map[26][i] = map[i][26] = 1;
	}
	for (int i = 1; i <= SIZ; i++) {
		for (int j = 1; j <= SIZ; j++) {
			if (map[i][j] == 1) {
				locate(i, j * 2 - 1);
				cout << "■";
			}
		}
	}
	SetColor(DARKGREEN);
	for (int i = 10; i <= 20; i++) {
		if (i == 13 || i == 17)
			continue;
		map[i][10] = map[10][i] = map[20][i] = map[i][20] = 2;
	}
	create_tree(5, 5);
	create_tree(18, 18);
	for (int i = 1; i <= SIZ; i++) {
		for (int j = 1; j <= SIZ; j++) {
			if (map[i][j] == 2) {
				locate(i, j * 2 - 1);
				cout << "■";
			}
		}
	}
	SetColor(WHITE);
} else if (x == 3) {
	SIZ = 20;
	SetColor(DARKGREEN);
	map[12][6] = map[10][9] = map[11][4] = map[5][14] = map[15][2] = map[27][6] = map[12][7] = map[16][5] = map[14][2] =
	        map[11][12] = map[11][11] = 2;
	for (int i = 6; i <= 19; i++) {
		if (i >= 15 && i <= 17)
			continue;
		map[8][i] = 2;
	}
	for (int i = 3; i <= 19; i++) {
		if (i >= 15 && i <= 17)
			continue;
		map[i][8] = 2;
	}
	for (int i = 2; i < SIZ; i++) {
		for (int j = 2; j < SIZ; j++) {
			if (map[i][j] == 2) {
				locate(i, j * 2 - 1);
				cout << "■";
			}
		}
	}
	SetColor(GRAY);
	for (int i = 2; i <= 15; i++) {
		map[i][i] = 1;
		locate(i, i * 2 - 1);
		cout << "■";
	}
	SetColor(WHITE);
}

} void cleanbody(int x, int y); void putbody(int x, int y, int z);

void player_init() {

p1.hp = p2.hp = 300;
p1.gun = p2.gun = 1;
p1.direct = 4;
p2.direct = 2;
p1.x = 2;
p1.y = 2;
p2.x = SIZ - 1;
p2.y = SIZ - 1;
putbody(p1.x, p1.y, 1);
putbody(p2.x, p2.y, 2);

}

void mapinit() {

for (int i = 1; i <= SIZ; i++) {
	map[i][1] = map[1][i] = map[SIZ][i] = map[i][SIZ] = 1;
}

}

void init() {

printf("Use Which Map?\n");
int x;
cin >> x;
system("cls");
use_map(x);
mapinit();
print_map();
player_init();

}

void putbody(int x, int y, int z) {

if (z == 1)
	SetColor(BLUE);
else if (z == 2)
	SetColor(RED);
locate(x, y * 2 - 1);
cout << "■";
SetColor(WHITE);

}

void cleanbody(int x, int y) {

locate(x, y * 2 - 1);
cout << " ";

}

/* LIST direct:

w 1
a 2
s 3
d 4

gun:

usp 1
mimigun 2
awp 3

block:

void 0
stone 1
tree 2
player 3
clip 4

*/ bool judge(int x, int y) {

if (map[x][y] == 1)
	return false;
if (map[x][y] == 2)
	return false;
if (map[x][y] == 3)
	return false;
return true;

}

bool judge_gun(int x, int y) {

if (map[x][y] == 1)
	return 0;
if (map[x][y] == 2)
	return 0;
if (map[x][y] == 3) {
	if (p1.x == x && p1.y == y)
		p1.hp -= 50;//此处暂时不管威力
	else
		p2.hp -= 50;
	return 0;
}
return 1;

} int cnt;

struct Clip {

int x, y;
int derect;
int force;
int start;
bool flag;

} clip[1000000];

void create_clip(int y, int x, int a, int b) {

int X, Y;
if (y == 1) {
	if (!judge_gun(a - 1, b))
		return;
	X = a - 1;
	Y = b;
} else if (y == 2) {
	if (!judge_gun(a, b - 1))
		return;
	X = a;
	Y = b - 1;
} else if (y == 3) {
	if (!judge_gun(a + 1, b))
		return;
	X = a + 1;
	Y = b;
} else if (y == 4) {
	if (!judge_gun(a, b + 1))
		return;
	X = a;
	Y = b + 1;
}
cnt++;
GetLocalTime( &sys );
clip[cnt].start = sys.wMilliseconds + sys.wSecond * 60 + sys.wHour * 3600;
clip[cnt].x = X;
clip[cnt].y = Y;
if (x == 1) {
	clip[cnt].derect = p1.direct;
} else if (x == 2) {
	clip[cnt].derect = p2.direct;
}

}

void shoot(int x) {

if (x == 1) {
	create_clip(p1.direct, 1, p1.x, p1.y);
} else if (x == 2) {
	create_clip(p2.direct, 2, p2.x, p2.y);
}

}

void clean_clip(int x, int y) {

locate(x, y * 2 - 1);
cout << "  ";
locate(1, 1);

}

void print_clip(int x, int y, int i) {

if (clip[i].flag) {
	clean_clip(x, y);
	return;
}
locate(x, y * 2 - 1);
SetColor(YELLOW);
cout << "::";
locate(1, 1);

// system("pause"); }

void clipmove() {

GetLocalTime( &sys );
int t = sys.wMilliseconds + sys.wSecond * 60 + sys.wHour * 3600;
for (int i = 1; i <= cnt; i++) {
	if (clip[i].flag)
		continue;
	if (abs(clip[i].start - t) > 50) {
		clip[i].start = t;
		int x = clip[i].x;
		int y = clip[i].y;
		if (clip[i].derect == 1) {
			if (!judge_gun(clip[i].x - 1, clip[i].y)) {
				clip[i].flag = 1;
				clean_clip(x, y);
				continue;
			}
			clean_clip(clip[i].x, clip[i].y);
			clip[i].x--;
			print_clip(clip[i].x, clip[i].y, i);
		} else if (clip[i].derect == 2) {
			if (!judge_gun(clip[i].x, clip[i].y - 1)) {
				clip[i].flag = 1;
				clean_clip(x, y);
				continue;
			}
			clean_clip(clip[i].x, clip[i].y);
			clip[i].y--;
			print_clip(clip[i].x, clip[i].y, i);
		} else if (clip[i].derect == 3) {
			if (!judge_gun(clip[i].x + 1, clip[i].y)) {
				clip[i].flag = 1;
				clean_clip(x, y);
				continue;
			}
			clean_clip(clip[i].x, clip[i].y);
			clip[i].x++;
			print_clip(clip[i].x, clip[i].y, i);
		} else if (clip[i].derect == 4) {
			if (!judge_gun(clip[i].x, clip[i].y + 1)) {
				clip[i].flag = 1;
				clean_clip(x, y);
				continue;
			}
			clean_clip(clip[i].x, clip[i].y);
			clip[i].y++;
			print_clip(clip[i].x, clip[i].y, i);
		}
	}
}

}

void judge_hp() {

int x = p1.hp;
int y = p2.hp;
if (x < 0 && y < 0 && x > y)
	swap(x, y);
if (x <= 0) {
	locate(1, 1);
	system("cls");
	printf("GAME OVER!\nTHE WINNER IS P2!");
	Sleep(5000);
	printf("\n-MADE BY Floatiy-");
	exit(0);
} else if (y <= 0) {
	locate(1, 1);
	system("cls");
	printf("GAME OVER!\nTHE WINNER IS P1!");
	Sleep(5000);
	printf("\n-MADE BY Floatiy-");
	exit(0);
}

}

void prog() {

char ch;
while (true) {
	if (kbhit()) {
		ch = getch();
		if (ch == 'w' && judge(p1.x - 1, p1.y)) {
			p1.direct = 1;
			cleanbody(p1.x, p1.y);
			map[p1.x][p1.y] = 0;
			putbody(--p1.x, p1.y, 1);
			map[p1.x][p1.y] = 3;
		} else if (ch == 'i' && judge(p2.x - 1, p2.y)) {
			p2.direct = 1;
			cleanbody(p2.x, p2.y);
			map[p2.x][p2.y] = 0;
			putbody(--p2.x, p2.y, 2);
			map[p2.x][p2.y] = 3;
		} else if (ch == 'a' && judge(p1.x, p1.y - 1)) {
			p1.direct = 2;
			cleanbody(p1.x, p1.y);
			map[p1.x][p1.y] = 0;
			putbody(p1.x, --p1.y, 1);
			map[p1.x][p1.y] = 3;
		} else if (ch == 'j' && judge(p2.x, p2.y - 1)) {
			p2.direct = 2;
			cleanbody(p2.x, p2.y);
			map[p2.x][p2.y] = 0;
			putbody(p2.x, --p2.y, 2);
			map[p2.x][p2.y] = 3;
		} else if (ch == 's' && judge(p1.x + 1, p1.y)) {
			p1.direct = 3;
			cleanbody(p1.x, p1.y);
			map[p1.x][p1.y] = 0;
			putbody(++p1.x, p1.y, 1);
			map[p1.x][p1.y] = 3;
		} else if (ch == 'k' && judge(p2.x + 1, p2.y)) {
			p2.direct = 3;
			cleanbody(p2.x, p2.y);
			map[p2.x][p2.y] = 0;
			putbody(++p2.x, p2.y, 2);
			map[p2.x][p2.y] = 3;
		} else if (ch == 'd' && judge(p1.x, p1.y + 1)) {
			p1.direct =  4;
			cleanbody(p1.x, p1.y);
			map[p1.x][p1.y] = 0;
			putbody(p1.x, ++p1.y, 1);
			map[p1.x][p1.y] = 3;
		} else if (ch == 'l' && judge(p2.x, p2.y + 1)) {
			p2.direct = 4;
			cleanbody(p2.x, p2.y);
			map[p2.x][p2.y] = 0;
			putbody(p2.x, ++p2.y, 2);
			map[p2.x][p2.y] = 3;
		} else if (ch == ';') {
			shoot(2);
		} else if (ch == 'f') {
			shoot(1);
		}
		Sleep(20);
	}
	clipmove();
	judge_hp();
}

}

void welcome() {

printf("操作方法:\n玩家1 wasd控制移动,f攻击 只能往右侧打子弹\n玩家2 ijkl控制移动,;攻击 只能往左侧打子弹\n");
Sleep(2000);

}

int main() {

welcome();
GetLocalTime( &sys );
init();
prog();
return 0;

}


蒙青创 尹治达  •  1年前

include

include

include <windows.h>

include <conio.h>

using namespace std; int SIZ = 20; HANDLE hout = GetStdHandle(STD_OUTPUT_HANDLE); COORD coord; HANDLE hCon;

enum Color { DARKBLUE = 1, DARKGREEN, DARKTEAL, DARKRED, DARKPINK, DARKYELLOW, GRAY, DARKGRAY, BLUE, GREEN, TEAL, RED, PINK, YELLOW, WHITE };

void SetColor(Color c) {

if (hCon == NULL)
	hCon = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hCon, c);

} SYSTEMTIME sys;

//sys.wYear,sys.wMonth,sys.wDay,sys.wHour,sys.wMinute, sys.wSecond,sys.wMilliseconds,sys.wDayOfWeek struct PLAYER {

int x, y;
int hp;
int gun;
int direct;

} p1, p2; int map[1005][1005];

int abs(int x) {

if (x < 0)
	return -x;
return x;

}

void locate(int x, int y) {

coord.X = y - 1;
coord.Y = x - 1;
SetConsoleCursorPosition(hout, coord);

}

void print_map() {

locate(1, 1);
SetColor(GRAY);
for (int i = 1; i <= SIZ; i++)
	cout << "■";
locate(SIZ, 1);
for (int i = 1; i <= SIZ; i++)
	cout << "■";
for (int i = 2; i < SIZ; i++) {
	locate(i, 1);
	cout << "■";
	locate(i, SIZ * 2 - 1);
	cout << "■";
}
locate(SIZ + 1, 1);
SetColor(WHITE);

}

void create_tree(int x, int y) {

map[x][y] = map[x + 1][y] = map[x - 1][y] = map[x][y + 1] = map[x][y - 1] = 2;

}

void use_map(int x) {

if (x == 1) {
	SIZ = 20;
	SetColor(DARKGREEN);
	map[16][6] = map[15][6] = map[17][6] = map[16][7] = map[16][5] = map[14][13] = map[13][12] = map[13][13] = 2;
	for (int i = 2; i < SIZ; i++) {
		for (int j = 2; j < SIZ; j++) {
			if (map[i][j] == 2) {
				locate(i, j * 2 - 1);
				cout << "■";
			}
		}
	}
	SetColor(GRAY);
	for (int i = 5; i <= 15; i++) {
		map[i][i] = 1;
		locate(i, i * 2 - 1);
		cout << "■";
	}
	SetColor(WHITE);
} else if (x == 2) {
	SIZ = 30;
	SetColor(GRAY);
	for (int i = 4; i <= 26; i++) {
		if (i == 13 || i == 14 || i == 15)
			continue;
		map[i][4] = map[4][i] = map[26][i] = map[i][26] = 1;
	}
	for (int i = 1; i <= SIZ; i++) {
		for (int j = 1; j <= SIZ; j++) {
			if (map[i][j] == 1) {
				locate(i, j * 2 - 1);
				cout << "■";
			}
		}
	}
	SetColor(DARKGREEN);
	for (int i = 10; i <= 20; i++) {
		if (i == 13 || i == 17)
			continue;
		map[i][10] = map[10][i] = map[20][i] = map[i][20] = 2;
	}
	create_tree(5, 5);
	create_tree(18, 18);
	for (int i = 1; i <= SIZ; i++) {
		for (int j = 1; j <= SIZ; j++) {
			if (map[i][j] == 2) {
				locate(i, j * 2 - 1);
				cout << "■";
			}
		}
	}
	SetColor(WHITE);
} else if (x == 3) {
	SIZ = 20;
	SetColor(DARKGREEN);
	map[12][6] = map[10][9] = map[11][4] = map[5][14] = map[15][2] = map[27][6] = map[12][7] = map[16][5] = map[14][2] =
	        map[11][12] = map[11][11] = 2;
	for (int i = 6; i <= 19; i++) {
		if (i >= 15 && i <= 17)
			continue;
		map[8][i] = 2;
	}
	for (int i = 3; i <= 19; i++) {
		if (i >= 15 && i <= 17)
			continue;
		map[i][8] = 2;
	}
	for (int i = 2; i < SIZ; i++) {
		for (int j = 2; j < SIZ; j++) {
			if (map[i][j] == 2) {
				locate(i, j * 2 - 1);
				cout << "■";
			}
		}
	}
	SetColor(GRAY);
	for (int i = 2; i <= 15; i++) {
		map[i][i] = 1;
		locate(i, i * 2 - 1);
		cout << "■";
	}
	SetColor(WHITE);
} else if (x == 4) {
	SIZ = 20;

	SetColor(DARKGREEN);
	map[16][6] = map[6][6] = map[6][7] = map[6][5] = map[5][6] = map[5][5] = map[16][7] = map[15][6] = map[15][7] =
	        map[18][5] = map[18][6] = map[18][5] = map[18][13] = 2;
	for (int i = 2; i < SIZ; i++) {
		for (int j = 2; j < SIZ; j++) {
			if (map[i][j] == 2) {
				locate(i, j * 2 - 1);
				cout << "■";
			}
		}
	}
	for (int i = 6; i <= 19; i++) {
		if (i >= 15 && i <= 17)
			continue;
		map[8][i] = 2;
	}
	for (int i = 3; i <= 19; i++) {
		if (i >= 15 && i <= 17)
			continue;
		map[i][8] = 2;
	}
	for (int i = 2; i < SIZ; i++) {
		for (int j = 2; j < SIZ; j++) {
			if (map[i][j] == 2) {
				locate(i, j * 2 - 1);
				cout << "■";
			}
		}
	}
	SetColor(GRAY);
	SetColor(WHITE);
}

} void cleanbody(int x, int y); void putbody(int x, int y, int z);

void player_init() {

p1.hp = p2.hp = 300;
p1.gun = p2.gun = 1;
p1.direct = 4;
p2.direct = 2;
p1.x = 2;
p1.y = 2;
p2.x = SIZ - 1;
p2.y = SIZ - 1;
putbody(p1.x, p1.y, 1);
putbody(p2.x, p2.y, 2);

}

void mapinit() {

for (int i = 1; i <= SIZ; i++) {
	map[i][1] = map[1][i] = map[SIZ][i] = map[i][SIZ] = 1;
}

}

void init() {

printf("Use Which Map?\n");
int x;
cin >> x;
system("cls");
use_map(x);
mapinit();
print_map();
player_init();

}

void putbody(int x, int y, int z) {

if (z == 1)
	SetColor(BLUE);
else if (z == 2)
	SetColor(RED);
locate(x, y * 2 - 1);
cout << "■";
SetColor(WHITE);

}

void cleanbody(int x, int y) {

locate(x, y * 2 - 1);
cout << " ";

}

/* LIST direct:

w 1
a 2
s 3
d 4

gun:

usp 1
mimigun 2
awp 3

block:

void 0
stone 1
tree 2
player 3
clip 4

*/ bool judge(int x, int y) {

if (map[x][y] == 1)
	return false;
if (map[x][y] == 2)
	return false;
if (map[x][y] == 3)
	return false;
return true;

}

bool judge_gun(int x, int y) {

if (map[x][y] == 1)
	return 0;
if (map[x][y] == 2)
	return 0;
if (map[x][y] == 3) {
	if (p1.x == x && p1.y == y)
		p1.hp -= 50;//此处暂时不管威力
	else
		p2.hp -= 50;
	return 0;
}
return 1;

} int cnt;

struct Clip {

int x, y;
int derect;
int force;
int start;
bool flag;

} clip[1000000];

void create_clip(int y, int x, int a, int b) {

int X, Y;
if (y == 1) {
	if (!judge_gun(a - 1, b))
		return;
	X = a - 1;
	Y = b;
} else if (y == 2) {
	if (!judge_gun(a, b - 1))
		return;
	X = a;
	Y = b - 1;
} else if (y == 3) {
	if (!judge_gun(a + 1, b))
		return;
	X = a + 1;
	Y = b;
} else if (y == 4) {
	if (!judge_gun(a, b + 1))
		return;
	X = a;
	Y = b + 1;
}
cnt++;
GetLocalTime( &sys );
clip[cnt].start = sys.wMilliseconds + sys.wSecond * 60 + sys.wHour * 3600;
clip[cnt].x = X;
clip[cnt].y = Y;
if (x == 1) {
	clip[cnt].derect = p1.direct;
} else if (x == 2) {
	clip[cnt].derect = p2.direct;
}

}

void shoot(int x) {

if (x == 1) {
	create_clip(p1.direct, 1, p1.x, p1.y);
} else if (x == 2) {
	create_clip(p2.direct, 2, p2.x, p2.y);
}

}

void clean_clip(int x, int y) {

locate(x, y * 2 - 1);
cout << "  ";
locate(1, 1);

}

void print_clip(int x, int y, int i) {

if (clip[i].flag) {
	clean_clip(x, y);
	return;
}
locate(x, y * 2 - 1);
SetColor(YELLOW);
cout << "::";
locate(1, 1);

// system("pause"); }

void clipmove() {

GetLocalTime( &sys );
int t = sys.wMilliseconds + sys.wSecond * 60 + sys.wHour * 3600;
for (int i = 1; i <= cnt; i++) {
	if (clip[i].flag)
		continue;
	if (abs(clip[i].start - t) > 50) {
		clip[i].start = t;
		int x = clip[i].x;
		int y = clip[i].y;
		if (clip[i].derect == 1) {
			if (!judge_gun(clip[i].x - 1, clip[i].y)) {
				clip[i].flag = 1;
				clean_clip(x, y);
				continue;
			}
			clean_clip(clip[i].x, clip[i].y);
			clip[i].x--;
			print_clip(clip[i].x, clip[i].y, i);
		} else if (clip[i].derect == 2) {
			if (!judge_gun(clip[i].x, clip[i].y - 1)) {
				clip[i].flag = 1;
				clean_clip(x, y);
				continue;
			}
			clean_clip(clip[i].x, clip[i].y);
			clip[i].y--;
			print_clip(clip[i].x, clip[i].y, i);
		} else if (clip[i].derect == 3) {
			if (!judge_gun(clip[i].x + 1, clip[i].y)) {
				clip[i].flag = 1;
				clean_clip(x, y);
				continue;
			}
			clean_clip(clip[i].x, clip[i].y);
			clip[i].x++;
			print_clip(clip[i].x, clip[i].y, i);
		} else if (clip[i].derect == 4) {
			if (!judge_gun(clip[i].x, clip[i].y + 1)) {
				clip[i].flag = 1;
				clean_clip(x, y);
				continue;
			}
			clean_clip(clip[i].x, clip[i].y);
			clip[i].y++;
			print_clip(clip[i].x, clip[i].y, i);
		}
	}
}

}

void judge_hp() {

int x = p1.hp;
int y = p2.hp;
if (x < 0 && y < 0 && x > y)
	swap(x, y);
if (x <= 0) {
	locate(1, 1);
	system("cls");
	printf("GAME OVER!\nTHE WINNER IS P2!");
	Sleep(5000);
	printf("\n-MADE BY Floatiy-");
	exit(0);
} else if (y <= 0) {
	locate(1, 1);
	system("cls");
	printf("GAME OVER!\nTHE WINNER IS P1!");
	Sleep(5000);
	printf("\n-MADE BY Floatiy-");
	exit(0);
}

}

void prog() {

char ch;
while (true) {
	if (kbhit()) {
		ch = getch();
		if (ch == 'w' && judge(p1.x - 1, p1.y)) {
			p1.direct = 1;
			cleanbody(p1.x, p1.y);
			map[p1.x][p1.y] = 0;
			putbody(--p1.x, p1.y, 1);
			map[p1.x][p1.y] = 3;
		} else if (ch == 'i' && judge(p2.x - 1, p2.y)) {
			p2.direct = 1;
			cleanbody(p2.x, p2.y);
			map[p2.x][p2.y] = 0;
			putbody(--p2.x, p2.y, 2);
			map[p2.x][p2.y] = 3;
		} else if (ch == 'a' && judge(p1.x, p1.y - 1)) {
			p1.direct = 2;
			cleanbody(p1.x, p1.y);
			map[p1.x][p1.y] = 0;
			putbody(p1.x, --p1.y, 1);
			map[p1.x][p1.y] = 3;
		} else if (ch == 'j' && judge(p2.x, p2.y - 1)) {
			p2.direct = 2;
			cleanbody(p2.x, p2.y);
			map[p2.x][p2.y] = 0;
			putbody(p2.x, --p2.y, 2);
			map[p2.x][p2.y] = 3;
		} else if (ch == 's' && judge(p1.x + 1, p1.y)) {
			p1.direct = 3;
			cleanbody(p1.x, p1.y);
			map[p1.x][p1.y] = 0;
			putbody(++p1.x, p1.y, 1);
			map[p1.x][p1.y] = 3;
		} else if (ch == 'k' && judge(p2.x + 1, p2.y)) {
			p2.direct = 3;
			cleanbody(p2.x, p2.y);
			map[p2.x][p2.y] = 0;
			putbody(++p2.x, p2.y, 2);
			map[p2.x][p2.y] = 3;
		} else if (ch == 'd' && judge(p1.x, p1.y + 1)) {
			p1.direct =  4;
			cleanbody(p1.x, p1.y);
			map[p1.x][p1.y] = 0;
			putbody(p1.x, ++p1.y, 1);
			map[p1.x][p1.y] = 3;
		} else if (ch == 'l' && judge(p2.x, p2.y + 1)) {
			p2.direct = 4;
			cleanbody(p2.x, p2.y);
			map[p2.x][p2.y] = 0;
			putbody(p2.x, ++p2.y, 2);
			map[p2.x][p2.y] = 3;
		} else if (ch == ';') {
			shoot(2);
		} else if (ch == 'f') {
			shoot(1);
		}
		Sleep(20);
	}
	clipmove();
	judge_hp();
}

}

void welcome() {

printf("操作方法:\n玩家1 wasd控制移动,f攻击 只能往右侧打子弹\n玩家2 ijkl控制移动,;攻击 只能往左侧打子弹\n");
Sleep(2000);

}

int main() {

welcome();
GetLocalTime( &sys );
init();
prog();
return 0;

}


蒙青创 尹治达  •  1年前

include

include

include <windows.h>

include <conio.h>

using namespace std; int SIZ = 20; HANDLE hout = GetStdHandle(STD_OUTPUT_HANDLE); COORD coord; HANDLE hCon;

enum Color { DARKBLUE = 1, DARKGREEN, DARKTEAL, DARKRED, DARKPINK, DARKYELLOW, GRAY, DARKGRAY, BLUE, GREEN, TEAL, RED, PINK, YELLOW, WHITE };

void SetColor(Color c) {

if (hCon == NULL)
	hCon = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hCon, c);

} SYSTEMTIME sys;

//sys.wYear,sys.wMonth,sys.wDay,sys.wHour,sys.wMinute, sys.wSecond,sys.wMilliseconds,sys.wDayOfWeek struct PLAYER {

int x, y;
int hp;
int gun;
int direct;

} p1, p2; int map[1005][1005];

int abs(int x) {

if (x < 0)
	return -x;
return x;

}

void locate(int x, int y) {

coord.X = y - 1;
coord.Y = x - 1;
SetConsoleCursorPosition(hout, coord);

}

void print_map() {

locate(1, 1);
SetColor(GRAY);
for (int i = 1; i <= SIZ; i++)
	cout << "■";
locate(SIZ, 1);
for (int i = 1; i <= SIZ; i++)
	cout << "■";
for (int i = 2; i < SIZ; i++) {
	locate(i, 1);
	cout << "■";
	locate(i, SIZ * 2 - 1);
	cout << "■";
}
locate(SIZ + 1, 1);
SetColor(WHITE);

}

void create_tree(int x, int y) {

map[x][y] = map[x + 1][y] = map[x - 1][y] = map[x][y + 1] = map[x][y - 1] = 2;

}

void use_map(int x) {

if (x == 1) {
	SIZ = 20;
	SetColor(DARKGREEN);
	map[16][6] = map[15][6] = map[17][6] = map[16][7] = map[16][5] = map[14][13] = map[13][12] = map[13][13] = 2;
	for (int i = 2; i < SIZ; i++) {
		for (int j = 2; j < SIZ; j++) {
			if (map[i][j] == 2) {
				locate(i, j * 2 - 1);
				cout << "■";
			}
		}
	}
	SetColor(GRAY);
	for (int i = 5; i <= 15; i++) {
		map[i][i] = 1;
		locate(i, i * 2 - 1);
		cout << "■";
	}
	SetColor(WHITE);
} else if (x == 2) {
	SIZ = 30;
	SetColor(GRAY);
	for (int i = 4; i <= 26; i++) {
		if (i == 13 || i == 14 || i == 15)
			continue;
		map[i][4] = map[4][i] = map[26][i] = map[i][26] = 1;
	}
	for (int i = 1; i <= SIZ; i++) {
		for (int j = 1; j <= SIZ; j++) {
			if (map[i][j] == 1) {
				locate(i, j * 2 - 1);
				cout << "■";
			}
		}
	}
	SetColor(DARKGREEN);
	for (int i = 10; i <= 20; i++) {
		if (i == 13 || i == 17)
			continue;
		map[i][10] = map[10][i] = map[20][i] = map[i][20] = 2;
	}
	create_tree(5, 5);
	create_tree(18, 18);
	for (int i = 1; i <= SIZ; i++) {
		for (int j = 1; j <= SIZ; j++) {
			if (map[i][j] == 2) {
				locate(i, j * 2 - 1);
				cout << "■";
			}
		}
	}
	SetColor(WHITE);
} else if (x == 3) {
	SIZ = 20;
	SetColor(DARKGREEN);
	map[12][6] = map[10][9] = map[11][4] = map[5][14] = map[15][2] = map[27][6] = map[12][7] = map[16][5] = map[14][2] =
	        map[11][12] = map[11][11] = 2;
	for (int i = 6; i <= 19; i++) {
		if (i >= 15 && i <= 17)
			continue;
		map[8][i] = 2;
	}
	for (int i = 3; i <= 19; i++) {
		if (i >= 15 && i <= 17)
			continue;
		map[i][8] = 2;
	}
	for (int i = 2; i < SIZ; i++) {
		for (int j = 2; j < SIZ; j++) {
			if (map[i][j] == 2) {
				locate(i, j * 2 - 1);
				cout << "■";
			}
		}
	}
	SetColor(GRAY);
	for (int i = 2; i <= 15; i++) {
		map[i][i] = 1;
		locate(i, i * 2 - 1);
		cout << "■";
	}
	SetColor(WHITE);
} else if (x == 4) {
	SIZ = 20;

	SetColor(DARKGREEN);
	map[16][6] = map[6][6] = map[6][7] = map[6][5] = map[5][6] = map[5][5] = map[16][7] = map[15][6] = map[15][7] =
	        map[18][5] = map[18][6] = map[18][5] = map[18][13] = 2;
	for (int i = 2; i < SIZ; i++) {
		for (int j = 2; j < SIZ; j++) {
			if (map[i][j] == 2) {
				locate(i, j * 2 - 1);
				cout << "■";
			}
		}
	}
	for (int i = 6; i <= 19; i++) {
		if (i >= 15 && i <= 17)
			continue;
		map[8][i] = 2;
	}
	for (int i = 3; i <= 19; i++) {
		if (i >= 15 && i <= 17)
			continue;
		map[i][8] = 2;
	}
	for (int i = 2; i < SIZ; i++) {
		for (int j = 2; j < SIZ; j++) {
			if (map[i][j] == 2) {
				locate(i, j * 2 - 1);
				cout << "■";
			}
		}
	}
	SetColor(GRAY);
	SetColor(WHITE);
}

} void cleanbody(int x, int y); void putbody(int x, int y, int z);

void player_init() {

p1.hp = p2.hp = 300;
p1.gun = p2.gun = 1;
p1.direct = 4;
p2.direct = 2;
p1.x = 2;
p1.y = 2;
p2.x = SIZ - 1;
p2.y = SIZ - 1;
putbody(p1.x, p1.y, 1);
putbody(p2.x, p2.y, 2);

}

void mapinit() {

for (int i = 1; i <= SIZ; i++) {
	map[i][1] = map[1][i] = map[SIZ][i] = map[i][SIZ] = 1;
}

}

void init() {

printf("Use Which Map?\n");
int x;
cin >> x;
system("cls");
use_map(x);
mapinit();
print_map();
player_init();

}

void putbody(int x, int y, int z) {

if (z == 1)
	SetColor(BLUE);
else if (z == 2)
	SetColor(RED);
locate(x, y * 2 - 1);
cout << "■";
SetColor(WHITE);

}

void cleanbody(int x, int y) {

locate(x, y * 2 - 1);
cout << " ";

}

/* LIST direct:

w 1
a 2
s 3
d 4

gun:

usp 1
mimigun 2
awp 3

block:

void 0
stone 1
tree 2
player 3
clip 4

*/ bool judge(int x, int y) {

if (map[x][y] == 1)
	return false;
if (map[x][y] == 2)
	return false;
if (map[x][y] == 3)
	return false;
return true;

}

bool judge_gun(int x, int y) {

if (map[x][y] == 1)
	return 0;
if (map[x][y] == 2)
	return 0;
if (map[x][y] == 3) {
	if (p1.x == x && p1.y == y)
		p1.hp -= 50;//此处暂时不管威力
	else
		p2.hp -= 50;
	return 0;
}
return 1;

} int cnt;

struct Clip {

int x, y;
int derect;
int force;
int start;
bool flag;

} clip[1000000];

void create_clip(int y, int x, int a, int b) {

int X, Y;
if (y == 1) {
	if (!judge_gun(a - 1, b))
		return;
	X = a - 1;
	Y = b;
} else if (y == 2) {
	if (!judge_gun(a, b - 1))
		return;
	X = a;
	Y = b - 1;
} else if (y == 3) {
	if (!judge_gun(a + 1, b))
		return;
	X = a + 1;
	Y = b;
} else if (y == 4) {
	if (!judge_gun(a, b + 1))
		return;
	X = a;
	Y = b + 1;
}
cnt++;
GetLocalTime( &sys );
clip[cnt].start = sys.wMilliseconds + sys.wSecond * 60 + sys.wHour * 3600;
clip[cnt].x = X;
clip[cnt].y = Y;
if (x == 1) {
	clip[cnt].derect = p1.direct;
} else if (x == 2) {
	clip[cnt].derect = p2.direct;
}

}

void shoot(int x) {

if (x == 1) {
	create_clip(p1.direct, 1, p1.x, p1.y);
} else if (x == 2) {
	create_clip(p2.direct, 2, p2.x, p2.y);
}

}

void clean_clip(int x, int y) {

locate(x, y * 2 - 1);
cout << "  ";
locate(1, 1);

}

void print_clip(int x, int y, int i) {

if (clip[i].flag) {
	clean_clip(x, y);
	return;
}
locate(x, y * 2 - 1);
SetColor(YELLOW);
cout << "::";
locate(1, 1);

// system("pause"); }

void clipmove() {

GetLocalTime( &sys );
int t = sys.wMilliseconds + sys.wSecond * 60 + sys.wHour * 3600;
for (int i = 1; i <= cnt; i++) {
	if (clip[i].flag)
		continue;
	if (abs(clip[i].start - t) > 50) {
		clip[i].start = t;
		int x = clip[i].x;
		int y = clip[i].y;
		if (clip[i].derect == 1) {
			if (!judge_gun(clip[i].x - 1, clip[i].y)) {
				clip[i].flag = 1;
				clean_clip(x, y);
				continue;
			}
			clean_clip(clip[i].x, clip[i].y);
			clip[i].x--;
			print_clip(clip[i].x, clip[i].y, i);
		} else if (clip[i].derect == 2) {
			if (!judge_gun(clip[i].x, clip[i].y - 1)) {
				clip[i].flag = 1;
				clean_clip(x, y);
				continue;
			}
			clean_clip(clip[i].x, clip[i].y);
			clip[i].y--;
			print_clip(clip[i].x, clip[i].y, i);
		} else if (clip[i].derect == 3) {
			if (!judge_gun(clip[i].x + 1, clip[i].y)) {
				clip[i].flag = 1;
				clean_clip(x, y);
				continue;
			}
			clean_clip(clip[i].x, clip[i].y);
			clip[i].x++;
			print_clip(clip[i].x, clip[i].y, i);
		} else if (clip[i].derect == 4) {
			if (!judge_gun(clip[i].x, clip[i].y + 1)) {
				clip[i].flag = 1;
				clean_clip(x, y);
				continue;
			}
			clean_clip(clip[i].x, clip[i].y);
			clip[i].y++;
			print_clip(clip[i].x, clip[i].y, i);
		}
	}
}

}

void judge_hp() {

int x = p1.hp;
int y = p2.hp;
if (x < 0 && y < 0 && x > y)
	swap(x, y);
if (x <= 0) {
	locate(1, 1);
	system("cls");
	printf("GAME OVER!\nTHE WINNER IS P2!");
	Sleep(5000);
	printf("\n-MADE BY Floatiy-");
	exit(0);
} else if (y <= 0) {
	locate(1, 1);
	system("cls");
	printf("GAME OVER!\nTHE WINNER IS P1!");
	Sleep(5000);
	printf("\n-MADE BY Floatiy-");
	exit(0);
}

}

void prog() {

char ch;
while (true) {
	if (kbhit()) {
		ch = getch();
		if (ch == 'w' && judge(p1.x - 1, p1.y)) {
			p1.direct = 1;
			cleanbody(p1.x, p1.y);
			map[p1.x][p1.y] = 0;
			putbody(--p1.x, p1.y, 1);
			map[p1.x][p1.y] = 3;
		} else if (ch == 'i' && judge(p2.x - 1, p2.y)) {
			p2.direct = 1;
			cleanbody(p2.x, p2.y);
			map[p2.x][p2.y] = 0;
			putbody(--p2.x, p2.y, 2);
			map[p2.x][p2.y] = 3;
		} else if (ch == 'a' && judge(p1.x, p1.y - 1)) {
			p1.direct = 2;
			cleanbody(p1.x, p1.y);
			map[p1.x][p1.y] = 0;
			putbody(p1.x, --p1.y, 1);
			map[p1.x][p1.y] = 3;
		} else if (ch == 'j' && judge(p2.x, p2.y - 1)) {
			p2.direct = 2;
			cleanbody(p2.x, p2.y);
			map[p2.x][p2.y] = 0;
			putbody(p2.x, --p2.y, 2);
			map[p2.x][p2.y] = 3;
		} else if (ch == 's' && judge(p1.x + 1, p1.y)) {
			p1.direct = 3;
			cleanbody(p1.x, p1.y);
			map[p1.x][p1.y] = 0;
			putbody(++p1.x, p1.y, 1);
			map[p1.x][p1.y] = 3;
		} else if (ch == 'k' && judge(p2.x + 1, p2.y)) {
			p2.direct = 3;
			cleanbody(p2.x, p2.y);
			map[p2.x][p2.y] = 0;
			putbody(++p2.x, p2.y, 2);
			map[p2.x][p2.y] = 3;
		} else if (ch == 'd' && judge(p1.x, p1.y + 1)) {
			p1.direct =  4;
			cleanbody(p1.x, p1.y);
			map[p1.x][p1.y] = 0;
			putbody(p1.x, ++p1.y, 1);
			map[p1.x][p1.y] = 3;
		} else if (ch == 'l' && judge(p2.x, p2.y + 1)) {
			p2.direct = 4;
			cleanbody(p2.x, p2.y);
			map[p2.x][p2.y] = 0;
			putbody(p2.x, ++p2.y, 2);
			map[p2.x][p2.y] = 3;
		} else if (ch == ';') {
			shoot(2);
		} else if (ch == 'f') {
			shoot(1);
		}
		Sleep(20);
	}
	clipmove();
	judge_hp();
}

}

void welcome() {

printf("操作方法:\n玩家1 wasd控制移动,f攻击 只能往右侧打子弹\n玩家2 ijkl控制移动,;攻击 只能往左侧打子弹\n");
Sleep(2000);

}

int main() {

welcome();
GetLocalTime( &sys );
init();
prog();
return 0;

}


蒙青创 尹治达  •  1年前

include

include

include <windows.h>

include <conio.h>

using namespace std; int SIZ = 20; HANDLE hout = GetStdHandle(STD_OUTPUT_HANDLE); COORD coord; HANDLE hCon;

enum Color { DARKBLUE = 1, DARKGREEN, DARKTEAL, DARKRED, DARKPINK, DARKYELLOW, GRAY, DARKGRAY, BLUE, GREEN, TEAL, RED, PINK, YELLOW, WHITE };

void SetColor(Color c) {

if (hCon == NULL)
	hCon = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hCon, c);

} SYSTEMTIME sys;

//sys.wYear,sys.wMonth,sys.wDay,sys.wHour,sys.wMinute, sys.wSecond,sys.wMilliseconds,sys.wDayOfWeek struct PLAYER {

int x, y;
int hp;
int gun;
int direct;

} p1, p2; int map[1005][1005];

int abs(int x) {

if (x < 0)
	return -x;
return x;

}

void locate(int x, int y) {

coord.X = y - 1;
coord.Y = x - 1;
SetConsoleCursorPosition(hout, coord);

}

void print_map() {

locate(1, 1);
SetColor(GRAY);
for (int i = 1; i <= SIZ; i++)
	cout << "■";
locate(SIZ, 1);
for (int i = 1; i <= SIZ; i++)
	cout << "■";
for (int i = 2; i < SIZ; i++) {
	locate(i, 1);
	cout << "■";
	locate(i, SIZ * 2 - 1);
	cout << "■";
}
locate(SIZ + 1, 1);
SetColor(WHITE);

}

void create_tree(int x, int y) {

map[x][y] = map[x + 1][y] = map[x - 1][y] = map[x][y + 1] = map[x][y - 1] = 2;

}

void use_map(int x) {

if (x == 1) {
	SIZ = 20;
	SetColor(DARKGREEN);
	SetColor(GRAY);
	for (int i = 5; i <= 15; i++) {
		map[i][i] = 1;
		locate(i, i * 2 - 1);
		cout << "■";
	}
	SetColor(WHITE);
} else if (x == 2) {
	SIZ = 30;
	SetColor(GRAY);
	for (int i = 4; i <= 26; i++) {
		if (i == 13 || i == 14 || i == 15)
			continue;
		map[i][4] = map[4][i] = map[26][i] = map[i][26] = 1;
	}
	for (int i = 1; i <= SIZ; i++) {
		for (int j = 1; j <= SIZ; j++) {
			if (map[i][j] == 1) {
				locate(i, j * 2 - 1);
				cout << "■";
			}
		}
	}
	SetColor(DARKGREEN);
	for (int i = 10; i <= 20; i++) {
		if (i == 13 || i == 17)
			continue;
		map[i][10] = map[10][i] = map[20][i] = map[i][20] = 2;
	}
	create_tree(5, 5);
	create_tree(18, 18);
	for (int i = 1; i <= SIZ; i++) {
		for (int j = 1; j <= SIZ; j++) {
			if (map[i][j] == 2) {
				locate(i, j * 2 - 1);
				cout << "■";
			}
		}
	}
	SetColor(WHITE);
} else if (x == 3) {
	SIZ = 20;
	SetColor(DARKGREEN);
	map[12][6] = map[10][9] = map[11][4] = map[5][14] = map[15][2] = map[27][6] = map[12][7] = map[16][5] = map[14][2] =
	        map[11][12] = map[11][11] = 2;
	for (int i = 6; i <= 19; i++) {
		if (i >= 15 && i <= 17)
			continue;
		map[8][i] = 2;
	}
	for (int i = 3; i <= 19; i++) {
		if (i >= 15 && i <= 17)
			continue;
		map[i][8] = 2;
	}
	for (int i = 2; i < SIZ; i++) {
		for (int j = 2; j < SIZ; j++) {
			if (map[i][j] == 2) {
				locate(i, j * 2 - 1);
				cout << "■";
			}
		}
	}
	SetColor(GRAY);
	for (int i = 2; i <= 15; i++) {
		map[i][i] = 1;
		locate(i, i * 2 - 1);
		cout << "■";
	}
	SetColor(WHITE);
} else if (x == 4) {
	SIZ = 20;

	SetColor(DARKGREEN);
	map[16][6] = map[6][6] = map[6][7] = map[6][5] = map[5][6] = map[5][5] = map[16][7] = map[15][6] = map[15][7] =
	        map[18][5] = map[18][6] = map[18][5] = map[18][13] = 2;
	for (int i = 2; i < SIZ; i++) {
		for (int j = 2; j < SIZ; j++) {
			if (map[i][j] == 2) {
				locate(i, j * 2 - 1);
				cout << "■";
			}
		}
	}
	for (int i = 6; i <= 19; i++) {
		if (i >= 15 && i <= 17)
			continue;
		map[8][i] = 2;
	}
	for (int i = 3; i <= 19; i++) {
		if (i >= 15 && i <= 17)
			continue;
		map[i][8] = 2;
	}
	for (int i = 2; i < SIZ; i++) {
		for (int j = 2; j < SIZ; j++) {
			if (map[i][j] == 2) {
				locate(i, j * 2 - 1);
				cout << "■";
			}
		}
	}
	SetColor(GRAY);
	for (int i = 2; i <= 6; i++) {
		map[i + 5][i + 2] = 1;
		locate(i, i );
		cout << "■";
	}
	SetColor(WHITE);
} else if (x == 5) {
	SIZ = 20;
	SetColor(DARKGREEN);
	map[11][4] = map[11][5] = map[11][3] = map[10][4] = map[12][5] = map[12][4] = map[12][3] = map[10][3] = map[10][5] = 2;
	for (int i = 11; i <= 17; i++)
		map[16][i] = 2;
	for (int i = 1; i <= 17; i++)
		map[i][16] = 2;
	for (int i = 4; i <= 16; i++)
		map[10][i] = 2;
	for (int i = 2; i < SIZ; i++) {
		for (int j = 2; j < SIZ; j++) {
			if (map[i][j] == 2) {
				locate(i, j * 2 - 1);
				cout << "■";
			}
		}
	}
	SetColor(GRAY);

	for (int i = 3; i <= 14; i++) {
		map[i + 3][i] = 1;
		locate(i, i * 2 - 1);
		cout << "■";
	}
	for (int i = 2; i <= 6; i++) {
		map[i + 5][i + 2] = 1;
		locate(i, i );
		cout << "■";
	}
	for (int i = 2; i <= 6; i++) {
		map[i - 6][i + 2] = 1;
		locate(i, i );
		cout << "■";
	}
	for (int i = 5; i <= 15; i++) {
		map[i][i] = 1;
		cout << "■";
	}
	SetColor(WHITE);
}

} void cleanbody(int x, int y); void putbody(int x, int y, int z);

void player_init() {

p1.hp = p2.hp = 300;
p1.gun = p2.gun = 1;
p1.direct = 4;
p2.direct = 2;
p1.x = 2;
p1.y = 2;
p2.x = SIZ - 1;
p2.y = SIZ - 1;
putbody(p1.x, p1.y, 1);
putbody(p2.x, p2.y, 2);

}

void mapinit() {

for (int i = 1; i <= SIZ; i++) {
	map[i][1] = map[1][i] = map[SIZ][i] = map[i][SIZ] = 1;
}

}

void init() {

printf("Use Which Map?\n");
int x;
cin >> x;
system("cls");
use_map(x);
mapinit();
print_map();
player_init();

}

void putbody(int x, int y, int z) {

if (z == 1)
	SetColor(BLUE);
else if (z == 2)
	SetColor(RED);
locate(x, y * 2 - 1);
cout << "■";
SetColor(WHITE);

}

void cleanbody(int x, int y) {

locate(x, y * 2 - 1);
cout << " ";

}

/* LIST direct:

w 1 a 2 s 3 d 4 gun:

usp 1 mimigun 2 awp 3 block:

void 0 stone 1 tree 2 player 3 clip 4 */ bool judge(int x, int y) {

if (map[x][y] == 1)
	return false;
if (map[x][y] == 2)
	return false;
if (map[x][y] == 3)
	return false;
return true;

}

bool judge_gun(int x, int y) {

if (map[x][y] == 1)
	return 0;
if (map[x][y] == 2)
	return 0;
if (map[x][y] == 3) {
	if (p1.x == x && p1.y == y)
		p1.hp -= 50;//此处暂时不管威力
	else
		p2.hp -= 50;
	return 0;
}
return 1;

} int cnt;

struct Clip {

int x, y;
int derect;
int force;
int start;
bool flag;

} clip[1000000];

void create_clip(int y, int x, int a, int b) {

int X, Y;
if (y == 1) {
	if (!judge_gun(a - 1, b))
		return;
	X = a - 1;
	Y = b;
} else if (y == 2) {
	if (!judge_gun(a, b - 1))
		return;
	X = a;
	Y = b - 1;
} else if (y == 3) {
	if (!judge_gun(a + 1, b))
		return;
	X = a + 1;
	Y = b;
} else if (y == 4) {
	if (!judge_gun(a, b + 1))
		return;
	X = a;
	Y = b + 1;
}
cnt++;
GetLocalTime( &sys );
clip[cnt].start = sys.wMilliseconds + sys.wSecond * 60 + sys.wHour * 3600;
clip[cnt].x = X;
clip[cnt].y = Y;
if (x == 1) {
	clip[cnt].derect = p1.direct;
} else if (x == 2) {
	clip[cnt].derect = p2.direct;
}

}

void shoot(int x) {

if (x == 1) {
	create_clip(p1.direct, 1, p1.x, p1.y);
} else if (x == 2) {
	create_clip(p2.direct, 2, p2.x, p2.y);
}

}

void clean_clip(int x, int y) {

locate(x, y * 2 - 1);
cout << "  ";
locate(1, 1);

}

void print_clip(int x, int y, int i) {

if (clip[i].flag) {
	clean_clip(x, y);
	return;
}
locate(x, y * 2 - 1);
SetColor(YELLOW);
cout << "::";
locate(1, 1);

// system("pause"); }

void clipmove() {

GetLocalTime( &sys );
int t = sys.wMilliseconds + sys.wSecond * 60 + sys.wHour * 3600;
for (int i = 1; i <= cnt; i++) {
	if (clip[i].flag)
		continue;
	if (abs(clip[i].start - t) > 50) {
		clip[i].start = t;
		int x = clip[i].x;
		int y = clip[i].y;
		if (clip[i].derect == 1) {
			if (!judge_gun(clip[i].x - 1, clip[i].y)) {
				clip[i].flag = 1;
				clean_clip(x, y);
				continue;
			}
			clean_clip(clip[i].x, clip[i].y);
			clip[i].x--;
			print_clip(clip[i].x, clip[i].y, i);
		} else if (clip[i].derect == 2) {
			if (!judge_gun(clip[i].x, clip[i].y - 1)) {
				clip[i].flag = 1;
				clean_clip(x, y);
				continue;
			}
			clean_clip(clip[i].x, clip[i].y);
			clip[i].y--;
			print_clip(clip[i].x, clip[i].y, i);
		} else if (clip[i].derect == 3) {
			if (!judge_gun(clip[i].x + 1, clip[i].y)) {
				clip[i].flag = 1;
				clean_clip(x, y);
				continue;
			}
			clean_clip(clip[i].x, clip[i].y);
			clip[i].x++;
			print_clip(clip[i].x, clip[i].y, i);
		} else if (clip[i].derect == 4) {
			if (!judge_gun(clip[i].x, clip[i].y + 1)) {
				clip[i].flag = 1;
				clean_clip(x, y);
				continue;
			}
			clean_clip(clip[i].x, clip[i].y);
			clip[i].y++;
			print_clip(clip[i].x, clip[i].y, i);
		}
	}
}

}

void judge_hp() {

int x = p1.hp;
int y = p2.hp;
if (x < 0 && y < 0 && x > y)
	swap(x, y);
if (x <= 0) {
	locate(1, 1);
	system("cls");
	printf("GAME OVER!\nTHE WINNER IS P2!");
	Sleep(5000);
	printf("\n-MADE BY Floatiy-");
	exit(0);
} else if (y <= 0) {
	locate(1, 1);
	system("cls");
	printf("GAME OVER!\nTHE WINNER IS P1!");
	Sleep(5000);
	printf("\n-MADE BY Floatiy-");
	exit(0);
}

}

void prog() {

char ch;
while (true) {
	if (kbhit()) {
		ch = getch();
		if (ch == 'w' && judge(p1.x - 1, p1.y)) {
			p1.direct = 1;
			cleanbody(p1.x, p1.y);
			map[p1.x][p1.y] = 0;
			putbody(--p1.x, p1.y, 1);
			map[p1.x][p1.y] = 3;
		} else if (ch == 'i' && judge(p2.x - 1, p2.y)) {
			p2.direct = 1;
			cleanbody(p2.x, p2.y);
			map[p2.x][p2.y] = 0;
			putbody(--p2.x, p2.y, 2);
			map[p2.x][p2.y] = 3;
		} else if (ch == 'a' && judge(p1.x, p1.y - 1)) {
			p1.direct = 2;
			cleanbody(p1.x, p1.y);
			map[p1.x][p1.y] = 0;
			putbody(p1.x, --p1.y, 1);
			map[p1.x][p1.y] = 3;
		} else if (ch == 'j' && judge(p2.x, p2.y - 1)) {
			p2.direct = 2;
			cleanbody(p2.x, p2.y);
			map[p2.x][p2.y] = 0;
			putbody(p2.x, --p2.y, 2);
			map[p2.x][p2.y] = 3;
		} else if (ch == 's' && judge(p1.x + 1, p1.y)) {
			p1.direct = 3;
			cleanbody(p1.x, p1.y);
			map[p1.x][p1.y] = 0;
			putbody(++p1.x, p1.y, 1);
			map[p1.x][p1.y] = 3;
		} else if (ch == 'k' && judge(p2.x + 1, p2.y)) {
			p2.direct = 3;
			cleanbody(p2.x, p2.y);
			map[p2.x][p2.y] = 0;
			putbody(++p2.x, p2.y, 2);
			map[p2.x][p2.y] = 3;
		} else if (ch == 'd' && judge(p1.x, p1.y + 1)) {
			p1.direct =  4;
			cleanbody(p1.x, p1.y);
			map[p1.x][p1.y] = 0;
			putbody(p1.x, ++p1.y, 1);
			map[p1.x][p1.y] = 3;
		} else if (ch == 'l' && judge(p2.x, p2.y + 1)) {
			p2.direct = 4;
			cleanbody(p2.x, p2.y);
			map[p2.x][p2.y] = 0;
			putbody(p2.x, ++p2.y, 2);
			map[p2.x][p2.y] = 3;
		} else if (ch == ';') {
			shoot(2);
		} else if (ch == 'f') {
			shoot(1);
		}
		Sleep(20);
	}
	clipmove();
	judge_hp();
}

}

void welcome() {

printf("操作方法:\n玩家1 wasd控制移动,f攻击 只能往右侧打子弹\n玩家2 ijkl控制移动,;攻击 只能往左侧打子弹\n");
Sleep(2000);

}

int main() {

welcome();
GetLocalTime( &sys );
init();
prog();
return 0;

}


蒙自市凤凰小学又阝十尃亻二  •  1年前

//#include <bits/stdc++.h>

include

include

include

include

include

include

include

include

include

include

include

include

include

include <windows.h>

include <conio.h>

include

using namespace std;

const int maxn = 100;

define sleep 500//屏幕速度

struct civil { //文明

int level;
vector<int>planets;
string name;
bool alive;

} c[maxn];

struct planet { //星球

int dist;
int belong;
string name;

} p[maxn];

struct warship { //舰队

int from;
int frompl;
int to;
int ti;
warship() {}
warship(int _frompl, int _to, int _ti): from(p[_frompl].belong), frompl(_frompl), to(_to), ti(_ti) {}

};

bool operator<(warship a, warship b) {

return a.ti > b.ti;

}

string lv[] = {"石器时代", "青铜时代", "铁器时代", "蒸汽时代", "电气时代", "原子时代", "信息时代", "核能时代", "广播恒星坐标", "1/100光速航行", "1/10光速航行", "光速航行", "人造黑洞", "黑暗森林打击"};

string destroy[] = {"严寒", "烈焰", "双日凌空", "三日凌空", "三日连珠", "大撕裂", "大洪涝", "究极疫情"}; priority_queueq, r; int sum;

void lose(int id); string sFromInt(int x);

int main() { // system("COLOR 0A");

//freopen("ST.in","r",stdin);
//freopen("ST.out","w",stdout);
int i, j, n, year, cnt;
unsigned int sd = 2333;
cout << "文明的数量:";
cin >> n; //输入:第一行字符串个数,接下来若干行字符串
sum = n;
cout << n << "个文明的名字:" << endl;
for (i = 1; i <= n; i++) {
	cin >> c[i].name;
	p[i].name = c[i].name;
	unsigned int tmp = 622;
	for (j = 0; j < c[i].name.size(); j++)
		tmp = 703 * tmp + c[i].name[j];
	sd = sd * 3071 + tmp;
	srand(time(NULL));//每个名字(文明)的初始等级是确定的,类似名字竞技场
	c[i].level = rand() % 7;
	//cout<<"level:"<<c[i].level<<endl;
	c[i].planets.push_back(i);
	c[i].alive = true;
	p[i].dist = rand() % 50 + 10;
	p[i].belong = i;
}
cout << "宇宙在一片黑暗中诞生了..." << endl;
Sleep(2000);
system("cls");
srand(time(NULL));//之后的演化会受所有输入名字的共同影响,也会被名字顺序影响
for (i = n + 1; i <= n * 2; i++) { //1~n星球是n个文明的母星
	p[i].dist = rand() % 50 + 10;
	//n+1~n*2星球是无人星球
	p[i].belong = 0;
	p[i].name = sFromInt(i - n) + "号";

	/*
	//n+i星球属于第i个文明
	p[i].belong=i-n;
	p[i].name=c[i-n].name+"2号";
	c[i-n].planets.push_back(i);
	*/
}
for (year = 0;; year += 10) {
	//cout<<"第"<<year<<"年"<<endl;
	while (!q.empty() && year > q.top().ti) { //舰队到达
		warship now = q.top();
		q.pop();
		int id = now.to;
		i = now.from;
		if (p[id].belong == i)
			continue;
		cout << "来自" << c[i].name << "文明的舰队到达" << p[id].name << "星球,";
		if (p[id].belong == 0 || (c[p[id].belong].level < c[i].level && rand() % 3)) {
			cout << "并占领了" << p[id].name << "星球" << endl;
			lose(id);
			p[id].belong = i;
			c[i].planets.push_back(id);
			if (!c[i].alive) {
				cout << c[i].name << "文明重生" << endl;
				c[i].alive = true;
				sum++;
			}
		} else {
			cout << "攻击失败" << endl;
			if (c[p[id].belong].level >= 7) {
				cout << p[id].name << "星球广播了" << p[now.frompl].name << "星球的位置" << endl;
				if (rand() % 2)
					r.push(warship(0, now.frompl, rand() % 5 * 10 + year + p[now.frompl].dist + p[id].dist));
			}
		}
		Sleep(sleep);
	}
	while (!r.empty() && year > r.top().ti) { //黑暗森林打击到达
		int id = r.top().to;
		r.pop();
		cout << p[id].name << "星球被黑暗森林打击" << endl;
		lose(id);
		p[id].belong = 0;
		Sleep(sleep);
	}
	for (i = 1; i <= n; i++) {
		if (!c[i].alive)
			continue;
		if (rand() % 20 == 0) { //技术爆炸
			c[i].level++;
			cout << c[i].name << "文明发生技术爆炸,";
			if (c[i].level <= 11) {
				if (c[i].level < 7)
					cout << "进入" << lv[c[i].level] << endl;
				else
					cout << "具备" << lv[c[i].level] << "能力" << endl;
			} else
				cout << "等级" << c[i].level << endl;
			Sleep(sleep);
		} else if (rand() % 10 == 0 && c[i].level > 7 && c[i].planets.size() < n * 2) { //发出舰队
			int id;
			do {
				id = rand() % (n * 2) + 1;
			} while (p[id].belong == i);
			int speed = min(c[i].level, 10);
			int d = p[c[i].planets[0]].dist + p[id].dist;
			if (speed == 8)
				d *= 100;
			if (speed == 9)
				d *= 10;
			cout << c[i].name << "文明向" << p[id].name << "星球发出" << lv[speed] << "舰队,将在" << d << "年后到达" << endl;
			q.push(warship(c[i].planets[0], id, year + d));
			Sleep(sleep);
		}
	}
	if (rand() % 100 == 0) { //自然灾害(全部来自《三体1》)
		int id;
		do {
			id = rand() % (n * 2) + 1;
		} while (p[id].belong == 0);
		cout << p[id].name << "星球上的文明在" << destroy[rand() % 8] << "中毁灭了" << endl;
		lose(id);
		p[id].belong = 0;
		Sleep(sleep);
		if (sum == 1) {
			//system("pause");
			return 0;
		}
	}
}
return 0;

}

void lose(int id) {

int i = p[id].belong;
if (i == 0)
	return;
vector<int> &v = c[i].planets;
vector<int>::iterator it;
for (it = v.begin(); it != v.end(); it++)
	if (*it == id)
		break;
v.erase(it);
if (v.size() == 0) {
	c[i].alive = false;
	sum--;
	cout << ">>" << c[i].name << "文明毁灭了" << endl;
	Sleep(sleep * 2);
}

}

string sFromInt(int x) {

string ret;
while (x) {
	ret = char(x % 10 + '0') + ret;
	x /= 10;
}
return ret;

}


蒙自市凤凰小学又阝十尃亻二  •  1年前

请先登录,才能进行评论