-
个人简介
退游暗区了
https://fun.360.cn/playgame?ad_source=iaa&djsource=Oc0Ca1&gameId=1027&srcid=Microsoft&msstart_sdk_init=eyJwYXJlbnRPcmlnaW4iOiJodHRwczovL3d3dy5tc24uY24iLCJjbGllbnRJZCI6IjI1MDMyNDhDRjA5NzZBRTAyQTM5MzFCNUYxM0I2QjBFIiwibG9jYWxlIjoiemgtY24iLCJlbnRyeVBvaW50SWQiOiJ3aW5kX3Nwb3RfY2czMDIifQ
最喜欢的网址: https://poki.com/zh/g/combat-reloaded 惊喜==https://www.minecraft.net/zh-hans 另一个学习网址:https://oiclass.com/ https://game.fm/city-sniper-826/?scoresType=game#google_vignette
小游戏:
/************************贪吃蛇***********************/ /**********************2012-11-20*********************/ #include <iostream> #include <cstdio> #include <cstdlib> #include <ctime> #include <conio.h> #include <cmath> #include <windows.h> using namespace std; /*** 光标定位 ***/ HANDLE hout=GetStdHandle(STD_OUTPUT_HANDLE); COORD coord; void locate(int x,int y) { coord.X=y; coord.Y=x; SetConsoleCursorPosition(hout,coord); }; /*** 隐藏光标 ***/ void hide() { CONSOLE_CURSOR_INFO cursor_info={1,0}; SetConsoleCursorInfo(hout, &cursor_info); } /*** 生成随机数 ***/ double random(double start, double end) { return start+(end-start)*rand()/(RAND_MAX + 1.0); } /*** 定义地图的长宽,蛇的坐标,长度,方向,食物的位置 ***/ int m,n; struct node { int x,y; }snake[1000]; int snake_length,dir; node food; int direct[4][2]={{-1,0},{1,0},{0,-1},{0,1}}; /*** 输出墙 ***/ void print_wall() { cout << " "; for (int i=1;i<=n;i++) cout << "-"; cout << endl; for (int j=0;j<=m-1;j++) { cout << "|"; for (int i=1;i<=n;i++) cout << " "; cout << "|" << endl; } cout << " "; for (int i=1;i<=n;i++) cout << "-"; } /*** 首次输出蛇,其中snake[0]代表头 ***/ void print_snake() { locate(snake[0].x,snake[0].y); cout << "@"; for (int i=1;i<=snake_length-1;i++) { locate(snake[i].x,snake[i].y); cout << "*"; } } /*** 判断是否撞墙或者自撞 ***/ bool is_correct() { if (snake[0].x==0 || snake[0].y==0 || snake[0].x==m+1 || snake[0].y==n+1) return false; for (int i=1;i<=snake_length-1;i++) { if (snake[0].x==snake[i].x && snake[0].y==snake[i].y) return false; } return true; } /*** 随机生成并输出食物位置 ***/ bool print_food() { srand((unsigned)time(0)); bool e; while (1) { e=true; int i=(int) random(0,m)+1,j=(int) random(0,n)+1; food.x=i;food.y=j; for (int k=0;k<=snake_length-1;k++) { if (snake[k].x==food.x && snake[k].y==food.y) { e=false;break; } } if (e) break; } locate(food.x,food.y); cout << "$"; return true; } /*** 蛇的前进 ***/ bool go_ahead() { node temp; bool e=false; temp=snake[snake_length-1]; for (int i=snake_length-1;i>=1;i--) snake[i]=snake[i-1]; snake[0].x+=direct[dir][0]; snake[0].y+=direct[dir][1]; locate(snake[1].x,snake[1].y); cout << "*"; /*** 吃到了食物 ***/ if (snake[0].x==food.x && snake[0].y==food.y) { snake_length++; e=true; snake[snake_length-1]=temp; } /*** 输出此时蛇状态 ***/ if (!e) { locate(temp.x,temp.y); cout << " "; } else print_food(); locate(snake[0].x,snake[0].y); cout << "@"; /*** 如果自撞 ***/ if (!is_correct()) { system("cls"); cout << "You lose!" << endl << "Length: " << snake_length << endl; return false; } return true; } /*** 主函数 ***/ int main() { cout << "--------------------贪吃蛇---------------------" << endl; cout << "请注意窗口大小,以免发生错位.建议将窗口调为最大." << endl; cout << "先选择难度.请在1-10中输入1个数,1最简单,10则最难" << endl; cout << "然后进入游戏画面,以方向键控制方向.祝你游戏愉快!" << endl; cout << "-----------------------------------------------" << endl; m=25; n=40; if (m<10 || n<10 || m>25 || n>40) { cout << "ERROR" << endl; system("pause"); return 0; } int hard; cin >> hard; if (hard<=0 || hard>100) { cout << "ERROR" << endl; system("pause"); return 0; } /*** 数据全部初始化,包括蛇长,位置,方向 ***/ snake_length=5; clock_t a,b; char ch; double hard_len; for (int i=0;i<=4;i++) { snake[i].x=1; snake[i].y=5-i; } dir=3; /*** 输出初始地图,蛇与食物 ***/ system("cls"); hide(); print_wall(); print_food(); print_snake(); locate(m+2,0); cout << "Now length: "; /*** 开始游戏 ***/ while (1) { /*** 难度随长度增加而提高 ***/ hard_len=(double)snake_length/(double) (m*n); /*** 调节时间,单位是ms ***/ a=clock(); while (1) { b=clock(); if (b-a>=(int)(400-30*hard)*(1-sqrt(hard_len))) break; } /*** 接受键盘输入的上下左右,并以此改变方向 ***/ if (kbhit()) { ch=getch(); if (ch==-32) { ch=getch(); switch(ch) { case 72: if (dir==2 || dir==3) dir=0; break; case 80: if (dir==2 || dir==3) dir=1; break; case 75: if (dir==0 || dir==1) dir=2; break; case 77: if (dir==0 || dir==1) dir=3; break; } } } /*** 前进 ***/ if (!go_ahead()) break; /*** 在最后输出此时长度 ***/ locate(m+2,12); cout << snake_length; } system("pause"); return 0; }
俄罗斯方块
#include<iostream> #include<string> #include<cstdlib> #include<windows.h> #include<ctime> #include<conio.h> #include<cstdio> using namespace std; class Tetris { private: int rank; //游戏难度等级 int score; // 得分 int id; //图形ID int point[2]; //两基点 int top; //最高点高度 public: Tetris(); void Welocme(); //首界面 void DrawMap(); //游戏界面 void SetColor(int); //控制颜色 void Draw(int, int, int); //画图形 void Run(); //运行游戏 void ReDraw(int, int, int); //清除图形 bool Judge(int, int, int); void Turn(int); //旋转 void Updata(); // 更新界面 void Pause(); //游戏暂停 void Input_score(); }; const int sharp[15][8] = //组成图形的各个点的各个坐标,先纵后横 { {0,0,1,0,2,0,3,0},{0,0,0,1,0,2,0,3}, {0,0,1,0,0,1,1,1}, {0,0,1,0,1,1,1,2},{0,1,1,1,2,0,2,1},{0,0,0,1,0,2,1,2},{0,0,0,1,1,0,2,0}, {1,0,1,1,1,2,0,2},{0,0,0,1,1,1,2,1},{0,0,0,1,0,2,1,0},{0,0,1,0,2,0,2,1}, {0,0,0,1,1,1,1,2},{0,1,1,0,1,1,2,0}, {0,1,0,2,1,0,1,1},{0,0,1,0,1,1,2,1} }; const int high[15] = { 4,1,2,2,3,2,3,2,3,2,3,2,3,2,3 }; int map[28][16]; #define a1 0 //条形 #define a2 1 #define b 2 // 方块 #define c1 3 //L形 #define c2 4 #define c3 5 #define c4 6 #define d1 7 //T形 #define d2 8 #define d3 9 #define d4 10 #define e1 11 //闪电1形 #define e2 12 #define f1 13 //闪电2形 #define f2 14 Tetris::Tetris() //构造函数, 初始化各个值 { point[0] = 0; point[1] = 5; score = 0; top = 25; } void Tetris::Turn(int num) //旋转函数 { switch (num) { case a1: id = a2; break; //条形互换 case a2: id = a1; break; case b: id = b; break; //方块无法旋转 case c1: id = c2; break; //各种L形互换 case c2: id = c3; break; case c3: id = c4; break; case c4: id = c1; break; case d1: id = d2; break; //各种T形互换 case d2: id = d3; break; case d3: id = d4; break; case d4: id = d1; break; case e1: id = e2; break; //两种闪电形互换 case e2: id = e1; break; case f1: id = f2; break; case f2: id = f1; break; } } void SetPos(int i, int j) //控制光标位置, 列, 行 { COORD pos = { i,j }; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos); } void Tetris::Pause() // 暂停函数 { SetPos(32, 10); cout << "游戏暂停!" << endl; SetPos(30, 11); cout << "你的分数为 " << score; char temp; while (1) { while (1) { if (_kbhit()) { temp = _getch(); break; } } if (temp == 32) break; } SetPos(32, 10); // 清除暂停时显示的信息 cout << " "; SetPos(30, 11); cout << " "; } void Tetris::Updata() //更新函数 { int i, flag; int nx, ny; for (i = 0; i < 4; i++) { nx = point[0] + sharp[id][i * 2]; ny = point[1] + sharp[id][i * 2 + 1]; SetPos((ny + 1) * 2, nx + 1); SetColor(0); cout << "■"; map[nx][ny] = 1; //界面各个点是否为空的更新 } if (point[0] < top) top = point[0]; //最高点的更新 for (i = point[0]; i < point[0] + high[id]; i++) //消除行 { flag = 1; for (int j = 0; j < 13; j++) //判定某一行是否满, 用flag来标记 if (map[i][j] == 0) flag = 0; if (flag == 1) { for (int k = i; k >= top; k--) { for (int p = 0; p < 13; p++) { map[k][p] = map[k - 1][p]; SetPos((p + 1) * 2, k + 1); if (map[k][p] == 1) cout << "■"; else cout << " "; } } score += 10; Input_score(); } } } void Tetris::Input_score() { SetColor(3); SetPos(30, 19); cout << "得分: " << score; } void Tetris::Welocme() //欢迎界面 { SetColor(1); char x; while (1) { system("cls"); cout << "■■■■■■■■■■■■■■■■■■■■■" << endl; cout << " 俄罗斯方块 " << endl; cout << "■■■■■■■■■■■■■■■■■■■■■" << endl; cout << " 操作方式:" << endl; cout << " ↑ - 旋转" << endl; cout << " ↓ - 加速下移" << endl; cout << " ← - 左移" << endl; cout << " → - 右移" << endl; cout << " 空格 - 暂停" << endl; cout << "■■■■■■■■■■■■■■■■■■■■■" << endl; cout << "■ 按1—3选择难度■" << endl; SetPos(20, 10); x = getchar(); if (x <= '9' && x >= '0') { rank = x - '0'; break; } } } void Tetris::SetColor(int color_num) //设置颜色 { int n; switch (color_num) { case 0: n = 0x08; break; case 1: n = 0x0C; break; case 2: n = 0x0D; break; case 3: n = 0x0E; break; case 4: n = 0x0A; break; } SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), n); } void Tetris::DrawMap() //画游戏时界面 { int i; SetColor(0); for (i = 0; i < 24; i++) //宽24格 { SetPos(i * 2, 0); cout << "■"; SetPos(i * 2, 26); cout << "■"; } for (i = 0; i < 26; i++) //高26格 { SetPos(0, i); cout << "■"; SetPos(28, i); cout << "■"; SetPos(46, i); cout << "■"; } for (i = 14; i < 24; i++) { SetPos(i * 2, 16); cout << "■"; } SetColor(3); Input_score(); SetPos(30, 21); cout << "难度等级: " << rank; SetPos(32, 2); cout << "下一图形"; } void Tetris::Draw(int x, int y, int num) //画图形 { int nx, ny; for (int i = 0; i < 4; i++) { nx = x + sharp[num][2 * i]; ny = y + sharp[num][2 * i + 1]; SetPos((ny + 1) * 2, nx + 1); SetColor(i + 1); cout << "■"; } } void Tetris::ReDraw(int x, int y, int num) //为更新图形的位置清除图形 { int nx, ny; for (int i = 0; i < 4; i++) { nx = x + sharp[num][2 * i]; ny = y + sharp[num][2 * i + 1]; SetPos((ny + 1) * 2, nx + 1); cout << " "; } } bool Tetris::Judge(int x, int y, int num) //判定在x, y 所指位置是否可画编号为 { //num 的图形, 若不可画则反回true int nx, ny; for (int i = 0; i < 4; i++) { nx = x + sharp[num][2 * i]; ny = y + sharp[num][2 * i + 1]; if (!(nx < 25 && nx >= 0 && ny < 13 && ny >= 0 && !map[nx][ny])) return true; } return false; } void Tetris::Run() //运行游戏 { int next_id; srand((int)time(0)); id = rand() % 15; next_id = rand() % 15; Draw(point[0], point[1], id); Draw(5, 16, next_id); int count; if (rank == 1) count = 150; else if (rank == 2) count = 100; else if (rank==3) count = 50; else count = 5; int i = 0; //不同等级对应不同count while (1) { if (!(i < count)) //i 与 count 用于控制时间 { i = 0; if (Judge(point[0] + 1, point[1], id)) //在某一位置不能下落的话 { Updata(); id = next_id; ReDraw(5, 16, next_id); next_id = rand() % 15; point[0] = 0; point[1] = 5; Draw(point[0], point[1], id); Draw(5, 16, next_id); if (Judge(point[0], point[1], id)) { system("cls"); SetPos(20, 10); cout << "游戏结束!" << endl; SetPos(20, 11); cout << "你的分数为 " << score << endl; system("pause"); exit(1); } } else //继续下落 { ReDraw(point[0], point[1], id); point[0]++; Draw(point[0], point[1], id); } } if (_kbhit()) //键盘输入值时 { int key, key2; key = _getch(); if (key == 224) { key2 = _getch(); if (key2 == 72) //按向上方向键时 { int temp = id; Turn(id); if (Judge(point[0], point[1], id)) id = temp; ReDraw(point[0], point[1], temp); Draw(point[0], point[1], id); } if (key2 == 80) //按向下方向键时 { if (!Judge(point[0] + 2, point[1], id)) { ReDraw(point[0], point[1], id); point[0] += 2; Draw(point[0], point[1], id); } } else if (key2 == 75) //按向左方向键时 { if (!Judge(point[0], point[1] - 1, id)) { ReDraw(point[0], point[1], id); point[1]--; Draw(point[0], point[1], id); } } else if (key2 == 77) //按向右方向键时 { if (!Judge(point[0], point[1] + 1, id)) { ReDraw(point[0], point[1], id); point[1]++; Draw(point[0], point[1], id); } } } else if (key == 32) // 按下空格暂停 Pause(); } Sleep(1); //等待1毫秒 i++; //控制下落间隔 } } int main() { Tetris game; game.Welocme(); system("cls"); //清除欢迎界面 game.DrawMap(); game.Run(); }
#include<bits/stdc++.h> #include<windows.h> using namespace std; int b[5][100]; int d[5][100]; void print(string a,string c){ for(int i=0;i<a.size();i++){ cout<<a[i]; Sleep(1); } cout<<c; } void printg(int ty){ cout<<"|"; for(int i=1;i<=20;i++){ if(b[ty][i]==1) print("?",""); else if(b[ty][i]==2) print("@",""); else if(b[ty][i]==3) print(">",""); else print(" ",""); } cout<<"|"<<endl; } int main(){ print(" ----植物大战僵尸---- ","\n"); print(">是双向射手","\n"); print("@是向日葵","\n"); print("?是僵尸","\n"); Sleep(400); system("cls"); print("开始游戏","\n"); memset(b,0,sizeof(b)); while(true){ system("cls"); print(" ----植物大战僵尸---- ","\n"); printg(1); printg(2); printg(3); printg(4); printg(5); print(" -------------------- ","\n"); int x,y,z; cin>>x>>y>>z; b[x][y]=z; if(b[x][y]==1) d[x][y]=100; for(int i=1;i<=5;i++){ for(int j=1;j<=20;j++){ if(b[i][j]==1){ b[i][j]=0; b[i][j-1]=1; d[i][j-1]=d[i][j]; d[i][j]=0; } } } for(int i=1;i<=5;i++){ for(int j=1;j<=100;j++){ if(b[i][j]==3){ for(int k=1;k<=100;k++){ if(b[i][k]==1){ d[i][k]-=35; if(d[i][k]<=0) b[i][k]=0; break; } } } } } for(int i=1;i<=5;i++){ b[i][20]=1; } } return 0; }
狼人杀
#include<bits/stdc++.h> #include<cstdio> #include<cstdlib> #include<ctime> #include<windows.h> using namespace std; struct IDname { int geshu; string NAME; }; IDname jue_se[100]; struct ID { int num; bool life; string name; int know; int how; }; ID player[21]; int n, MY, kill1, kill2; char a; bool jieyao = 1, duyao = 1; int lieren, shouwei = 0; void init1() { jue_se[1].NAME = "村民 "; jue_se[2].NAME = "狼人 "; jue_se[3].NAME = "女巫 "; jue_se[4].NAME = "预言家 "; jue_se[5].NAME = "猎人 "; jue_se[6].NAME = "守卫 "; } void init2(int nn) { switch (nn) { case 6: jue_se[1].geshu = 3; jue_se[2].geshu = 2; jue_se[3].geshu = 1; jue_se[4].geshu = 0; jue_se[5].geshu = 0; jue_se[6].geshu = 0; break; case 7: jue_se[1].geshu = 3; jue_se[2].geshu = 2; jue_se[3].geshu = 1; jue_se[4].geshu = 1; jue_se[5].geshu = 0; jue_se[6].geshu = 0; break; case 8: jue_se[1].geshu = 3; jue_se[2].geshu = 3; jue_se[3].geshu = 1; jue_se[4].geshu = 1; jue_se[5].geshu = 0; jue_se[6].geshu = 0; break; case 9: jue_se[1].geshu = 3; jue_se[2].geshu = 3; jue_se[3].geshu = 1; jue_se[4].geshu = 1; jue_se[5].geshu = 1; jue_se[6].geshu = 0; break; case 10: jue_se[1].geshu = 4; jue_se[2].geshu = 3; jue_se[3].geshu = 1; jue_se[4].geshu = 1; jue_se[5].geshu = 1; jue_se[6].geshu = 0; break; case 11: jue_se[1].geshu = 4; jue_se[2].geshu = 4; jue_se[3].geshu = 1; jue_se[4].geshu = 1; jue_se[5].geshu = 1; jue_se[6].geshu = 0; break; case 12: jue_se[1].geshu = 4; jue_se[2].geshu = 4; jue_se[3].geshu = 1; jue_se[4].geshu = 1; jue_se[5].geshu = 1; jue_se[6].geshu = 1; break; default: cout << "输入错误,再见" << endl; exit(0); break; } } int van[10] = { 7,4,6,43,35,1,2,8,20,19 }; void init3(int nn) { srand(time(0)); Sleep(rand() % 44); int x = 10000; int t = rand(); srand(time(NULL)); int y = van[(rand() % 100 * van[rand() % 10] + t) % 10]; if (nn <= 6) x = abs(x * 6 / y) % 3 + 1; else if (nn <= 8) x = abs(x * 7 / y) % 4 + 1; else if (nn <= 11) x = abs(x * 8 / y) % 5 + 1; else if (nn <= 14) x = abs(x * 9 / y) % 6 + 1; do { if (nn <= 6) x = x % 3 + 1; else if (nn <= 8) x = x % 4 + 1; else if (nn <= 11) x = x % 5 + 1; else if (nn <= 14) x = x % 6 + 1; if (jue_se[x].geshu > 0) { player[nn].name = jue_se[x].NAME; if (player[nn].name == "猎人 ") lieren = nn; if (player[nn].name == "守卫 ") shouwei = nn; player[nn].life = 1; player[nn].num = nn; player[nn].know = 0; jue_se[x].geshu--; player[nn].how = 0; break; } } while (jue_se[x].geshu == 0); } void printhhh() { int cm = 0; int sz = 0; for (int i = 1; i <= n; i++) { if (player[i].life == 0) continue; else if (player[i].name == "村民 ") cm++; else if (player[i].name == "女巫 " || player[i].name == "预言家 " || player[i].name == "猎人 " || player[i].name == "守卫 ") sz++; } if (sz == 0 || cm == 0) cout << "狼人阵营胜利" << endl; else cout << "好人阵营胜利" << endl; for (int i = 1; i <= n; i++) { cout << left << setw(3) << player[i].num << ": " << player[i].name << " "; if (player[i].life == 0) cout << "死亡" << "\t"; else cout << "存活" << "\t"; if (player[i].how == 0) cout << "最终存活 " << endl; else if (player[i].how == 1) cout << "最终被狼人杀死" << endl; else if (player[i].how == 2) cout << "最终被投票投死" << endl; else if (player[i].how == 3) cout << "最终被女巫毒死" << endl; else if (player[i].how == 4) cout << "最终被猎人射杀" << endl; } system("pause"); system("pause"); system("pause"); } void print(int day, int ti) { HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE); if (ti == 0) SetConsoleTextAttribute(handle, BACKGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_INTENSITY); else SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); cout << "\t\t\t\t第" << day << "天 "; if (ti == 0) cout << "白天" << endl; else cout << "夜晚" << endl; cout << "我的位置:" << MY << "号" << endl; for (int i = 1; i <= 6; i++) { cout << player[i].num << "号位 "; } cout << endl; for (int i = 1; i <= 6; i++) { if (player[i].life == 1) { if (ti == 0) SetConsoleTextAttribute(handle, BACKGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_INTENSITY | FOREGROUND_GREEN); else SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | FOREGROUND_GREEN); cout << "存活 "; } else { if (ti == 0) SetConsoleTextAttribute(handle, BACKGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_INTENSITY | FOREGROUND_RED); else SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | FOREGROUND_RED); cout << "已死亡 "; } } if (ti == 0) SetConsoleTextAttribute(handle, BACKGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_INTENSITY); else SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); cout << endl; for (int i = 1; i <= 6; i++) { if (player[i].know == 0) cout << "未知 "; else if (player[i].know == 1) { if (player[i].name == "狼人 ") cout << "狼人 "; else cout << "好人 "; } else if (player[i].know == 2) cout << player[i].name << " "; } cout << endl << endl; for (int i = 7; i <= n; i++) { if (i < 10) cout << player[i].num << "号位 "; else cout << player[i].num << "号位 "; } cout << endl; for (int i = 7; i <= n; i++) { if (player[i].life == 1) { if (ti == 0) SetConsoleTextAttribute(handle, BACKGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_INTENSITY | FOREGROUND_GREEN); else SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | FOREGROUND_GREEN); cout << "存活 "; } else { if (ti == 0) SetConsoleTextAttribute(handle, BACKGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_INTENSITY | FOREGROUND_RED); else SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | FOREGROUND_RED); cout << "已死亡 "; } } if (ti == 0) SetConsoleTextAttribute(handle, BACKGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | FOREGROUND_INTENSITY); else SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); cout << endl; for (int i = 7; i <= n; i++) { if (player[i].know == 0) cout << "未知 "; else if (player[i].know == 1) { if (player[i].name == "狼人 ") cout << "狼人 "; else cout << "好人 "; } else if (player[i].know == 2) cout << player[i].name << " "; } cout << endl << endl; } int shou = 0; void shoushui(int hhh, int hhhh) { int x; Sleep(3000); system("cls"); print(hhh, hhhh); cout << "守~卫~请~睁~眼~~~" << endl; Sleep(3000); system("cls"); print(hhh, hhhh); if (MY == shouwei && player[MY].life == 1) { cout << "请问你要守护谁?" << endl << "输入:"; cin >> x; while (x == shou || x<1 || x>n || player[x].life == 0) { cout << "输入错误,请重新输入" << endl << "输入:"; cin >> x; } shou = x; } else if (player[shouwei].life == 1) { cout << "请问你要守护谁?" << endl; Sleep(rand() % 98); srand(time(0)); x = rand() % n + 1; while (x == shou || player[x].life == 0) { Sleep(rand() % 98); srand(time(0)); x = rand() % n + 1; } shou = x; } else { cout << "请问你要守护谁?" << endl; Sleep(3000); shou = -1; } Sleep(3000); system("cls"); print(hhh, hhhh); cout << "守~卫~请~闭~眼~~~" << endl; } struct tou { int xxx; int num; int toupiaoquan; }; tou TOU[13]; bool cmp(tou x, tou y) { if (x.xxx == y.xxx) return x.num < y.num; return x.xxx > y.xxx; } bool cmp1(tou x, tou y) { return x.num < y.num; } void toupiao(int ddd, int nnn) { //--------1-------- int x; Sleep(2000); system("cls"); print(ddd, nnn); cout << "现在大家请投票"; for (int i = 1; i <= 3; i++) { cout << "."; Sleep(500); } cout << endl; for (int i = 1; i <= n; i++) { TOU[i].num = i; TOU[i].toupiaoquan = 1; TOU[i].xxx = 0; } for (int i = 1; i <= n; i++) { if (player[i].life == 1) { Sleep(3000); if (i == MY) { cout << "请投票...(0弃权)" << endl; cin >> x; while (player[x].life == 0 && x != 0) { cin >> x; } if (x == 0) cout << MY << "号玩家弃权" << endl; else cout << MY << "号玩家投给了" << x << "号玩家" << endl; } else { srand(time(0)); if (player[i].name == "狼人 ") { x = rand() % (n + 1); while (x != 0 && (player[x].life == 0 || player[x].name == "狼人 " || x == i)) { Sleep(rand() % 98); srand(time(0)); x = rand() % (n + 1); } if (x == 0) cout << i << "号玩家弃权" << endl; else cout << i << "号玩家投给了" << x << "号玩家" << endl; } else if (player[i].name == "预言家 ") { x = rand() % (n + 1); while (x != 0 && (player[x].life == 0 || player[x].name != "狼人 " || x == i)) { Sleep(rand() % 98); srand(time(0)); x = rand() % (n + 1); } if (x == 0) cout << i << "号玩家弃权" << endl; else cout << i << "号玩家投给了" << x << "号玩家" << endl; } else { x = rand() % (n + 1); while (x != 0 && (player[x].life == 0 || x == i)) { Sleep(rand() % 98); srand(time(0)); x = rand() % (n + 1); } if (x == 0) cout << i << "号玩家弃权" << endl; else cout << i << "号玩家投给了" << x << "号玩家" << endl; } } if (x != 0) TOU[x].xxx++; } } Sleep(3000); sort(TOU + 1, TOU + n + 1, cmp); if (TOU[2].xxx != TOU[1].xxx) { cout << "投票结束," << TOU[1].num << "号投票出局" << endl; player[TOU[1].num].life = 0; player[TOU[1].num].how = 2; Sleep(3000); return; } else { TOU[1].toupiaoquan = 0; TOU[2].toupiaoquan = 0; system("cls"); print(ddd, nnn); cout << TOU[1].num << "号," << TOU[2].num << "号"; int i; for (i = 3; i <= n; i++) { if (TOU[i].xxx == TOU[1].xxx) { TOU[i].toupiaoquan = 0; cout << "," << TOU[i].num << "号"; } else break; } if (i == n + 1) { for (int i = 1; i <= n; i++) TOU[i].toupiaoquan = 1; } cout << "平票" << endl; } //--------2-------- sort(TOU + 1, TOU + n + 1, cmp1); cout << "请再次投票"; for (int i = 1; i <= 3; i++) { cout << "."; Sleep(500); } cout << endl; for (int i = 1; i <= n; i++) { if (player[i].life == 1 && TOU[i].toupiaoquan == 1) { Sleep(3000); if (i == MY) { cout << "请投票...(0弃权)" << endl; cin >> x; while ((player[x].life == 0 || TOU[x].toupiaoquan == 1) && x != 0) { cin >> x; } if (x == 0) cout << MY << "号玩家弃权" << endl; else cout << MY << "号玩家投给了" << x << "号玩家" << endl; } else { srand(time(0)); if (player[i].name == "狼人 ") { x = rand() % (n + 1); while (x != 0 && (player[x].life == 0 || player[x].name == "狼人 " || x == i || TOU[x].toupiaoquan == 1)) { srand(time(0)); x = rand() % (n + 1); } if (x == 0) cout << i << "号玩家弃权" << endl; else cout << i << "号玩家投给了" << x << "号玩家" << endl; } else if (player[i].name == "预言家 ") { x = rand() % (n + 1); while (x != 0 && (player[x].life == 0 || player[x].name != "狼人 " || x == i || TOU[x].toupiaoquan == 1)) { srand(time(0)); x = rand() % (n + 1); } if (x == 0) cout << i << "号玩家弃权" << endl; else cout << i << "号玩家投给了" << x << "号玩家" << endl; } else { x = rand() % (n + 1); while (x != 0 && (player[x].life == 0 || x == i || TOU[x].toupiaoquan == 1)) { srand(time(0)); x = rand() % (n + 1); } if (x == 0) cout << i << "号玩家弃权" << endl; else cout << i << "号玩家投给了" << x << "号玩家" << endl; } } if (x != 0 && TOU[i].toupiaoquan == 1) TOU[x].xxx++; } } Sleep(3000); sort(TOU + 1, TOU + n + 1, cmp); if (TOU[2].xxx != TOU[1].xxx) { cout << "投票结束," << TOU[1].num << "号投票出局" << endl; player[TOU[1].num].life = 0; player[TOU[1].num].how = 2; Sleep(3000); return; } else { TOU[1].toupiaoquan = 0; TOU[2].toupiaoquan = 0; system("cls"); print(ddd, nnn); cout << TOU[1].num << "号," << TOU[2].num << "号"; int i; for (i = 3; i <= n; i++) { if (TOU[i].xxx == TOU[1].xxx) { TOU[i].toupiaoquan = 0; cout << "," << TOU[i].num << "号"; } else break; } if (i == n + 1) { for (int i = 1; i <= n; i++) TOU[i].toupiaoquan = 1; } cout << "平票" << endl; } //--------3-------- sort(TOU + 1, TOU + n + 1, cmp1); cout << "请再次投票"; for (int i = 1; i <= 3; i++) { cout << "."; Sleep(500); } cout << endl; for (int i = 1; i <= n; i++) { if (player[i].life == 1 && TOU[i].toupiaoquan == 1) { Sleep(3000); if (i == MY) { cout << "请投票...(0弃权)" << endl; cin >> x; while ((player[x].life == 0 || TOU[x].toupiaoquan == 1) && x != 0) { cin >> x; } if (x == 0) cout << MY << "号玩家弃权" << endl; else cout << MY << "号玩家投给了" << x << "号玩家" << endl; } else { srand(time(0)); if (player[i].name == "狼人 ") { x = rand() % (n + 1); while (x != 0 && (player[x].life == 0 || player[x].name == "狼人 " || x == i || TOU[x].toupiaoquan == 1)) { srand(time(0)); x = rand() % (n + 1); } if (x == 0) cout << i << "号玩家弃权" << endl; else cout << i << "号玩家投给了" << x << "号玩家" << endl; } else if (player[i].name == "预言家 " || player[i].name == "猎人 ") { x = rand() % (n + 1); while (x != 0 && (player[x].life == 0 || player[x].name != "狼人 " || x == i || TOU[x].toupiaoquan == 1)) { srand(time(0)); x = rand() % (n + 1); } if (x == 0) cout << i << "号玩家弃权" << endl; else cout << i << "号玩家投给了" << x << "号玩家" << endl; } else { x = rand() % (n + 1); while (x != 0 && (player[x].life == 0 || x == i || TOU[x].toupiaoquan == 1)) { srand(time(0)); x = rand() % (n + 1); } if (x == 0) cout << i << "号玩家弃权" << endl; else cout << i << "号玩家投给了" << x << "号玩家" << endl; } } if (x != 0 && TOU[i].toupiaoquan == 1) TOU[x].xxx++; } } Sleep(3000); sort(TOU + 1, TOU + n + 1, cmp); if (TOU[2].xxx != TOU[1].xxx) { cout << "投票结束," << TOU[1].num << "号投票出局" << endl; player[TOU[1].num].life = 0; player[TOU[1].num].how = 2; } else { cout << "投票结束,无人出局" << endl; } Sleep(5000); } bool game_over() { int pingmin = 0; int langren = 0; int shenzhi = 0; for (int i = 1; i <= n; i++) { if (player[i].life == 0) continue; if (player[i].name == "狼人 ") langren++; else if (player[i].name == "村民 ") pingmin++; else if (player[i].name == "女巫 " || player[i].name == "预言家 " || player[i].name == "猎人 ") shenzhi++; } if (shenzhi == 0 || langren == 0 || pingmin == 0) return 1; return 0; } void night() { system("cls"); system("color 0f"); print(1, 1); cout << "天~黑~请~闭~眼~~~" << endl; if (n >= 12) shoushui(1, 1); Sleep(3000); system("cls"); print(1, 1); cout << "狼~人~请~睁~眼~~~" << endl; if (player[MY].name == "狼人 ") { Sleep(1000); cout << "你的同伴有:"; for (int i = 1; i <= n; i++) { if (i == MY) continue; if (player[i].name == "狼人 ") { cout << player[i].num << "号 "; player[i].know = 2; } } Sleep(3000); cout << endl << "请问你们要杀谁:" << endl << "输入:"; cin >> kill1; Sleep(1500); system("cls"); print(1, 1); cout << "今晚你们要杀的是" << kill1 << "号玩家" << endl; } else { Sleep(4000); system("cls"); print(1, 1); cout << "请问你们要杀谁?" << endl; do { Sleep(rand() % 18); srand(time(0)); int x = rand() % n + 1; if (player[x].name != "狼人 " && player[x].life == 1) { kill1 = x; break; } } while (1); Sleep(5000); } Sleep(3000); system("cls"); print(1, 1); cout << "狼~人~请~闭~眼~~~" << endl; Sleep(2000); system("cls"); print(1, 1); cout << "女~巫~请~睁~眼~~~" << endl; Sleep(2000); system("cls"); print(1, 1); if (player[MY].name == "女巫 " && player[MY].life == 1) { Sleep(1000); if (jieyao == 1) { cout << "今晚" << kill1 << "号玩家被杀" << endl; Sleep(500); cout << "请问你要救吗???" << endl << "A. 救 B.不救" << endl << "输入:"; cin >> a; if (a == 'A') { system("cls"); print(1, 1); cout << "请问你要毒吗???" << endl; Sleep(2000); system("cls"); print(1, 1); cout << "今晚" << kill1 << "号玩家被你解救" << endl; jieyao = 0; if (shou != kill1) kill1 = 0; } else { if (shou == kill1) kill1 = 0; Sleep(2000); system("cls"); print(1, 1); cout << "请问你要毒吗???" << endl << "A. 毒 B.不毒" << endl << "输入:"; cin >> a; if (a == 'A') { cout << "请问你要毒谁???" << endl << "输入:"; cin >> kill2; while (player[kill2].life != 1) { cout << "输入错误,请重新输入:" << endl; cin >> kill2; } duyao = 0; } } } else { if (shou == kill1) kill1 = 0; Sleep(2000); system("cls"); print(1, 1); cout << "请问你要毒吗???" << endl << "A. 毒 B.不毒" << endl << "输入:"; cin >> a; if (a == 'A') { cout << "请问你要毒谁???" << endl << "输入:"; cin >> kill2; while (player[kill2].life != 1) { cout << "输入错误,请重新输入:" << endl; cin >> kill2; } duyao = 0; } } } else { bool b = 0; cout << "请问你是否要用解药???" << endl; int FFF = 0, kkkk; for (int i = 1; i <= n; i++) { if (player[i].life == 1 && player[i].name == "村民 ") FFF++; if (player[i].name == "女巫 ") kkkk = i; } if (jieyao == 1 && player[kkkk].life == 1) { if (FFF == 1) { if (shou == kill1) jieyao = 1; else jieyao = 0; kill1 = 0; b = 1; } else for (int i = 1; i <= n; i++) { if (player[i].name == "女巫 " && kill1 == i) { kill1 = 0; if (shou == kill1) jieyao = 1; else jieyao = 0; b = 1; break; } else if (player[i].name == "预言家 " && kill1 == i) { kill1 = 0; if (shou == kill1) jieyao = 1; else jieyao = 0; b = 1; break; } } } Sleep(3000); if (b == 0 && duyao == 1 && player[kkkk].life == 1) { system("cls"); print(1, 1); cout << "请问你是否要用毒药???" << endl; srand(time(0)); int x = rand() % 2; Sleep(1500); cout << "请问你要毒谁???" << endl; if (x == 1) { duyao = 0; int y = rand() % n + 1; while ((player[y].name == "女巫 " || player[y].name == "预言家 " || y == kill1) || player[y].life == 0) y = rand() % n + 1; kill2 = y; } } else { Sleep(3000); system("cls"); print(1, 1); cout << "请问你是否要用毒药???" << endl; Sleep(3000); cout << "请问你要毒谁???" << endl; Sleep(3000); } } Sleep(3000); system("cls"); print(1, 1); cout << "女~巫~请~闭~眼~~~" << endl; if (n > 6) { Sleep(3000); system("cls"); print(1, 1); cout << "预~言~家~请~睁~眼~~~" << endl; if (player[MY].name == "预言家 ") { Sleep(3000); cout << "请问你想查验谁???" << endl << "输入:"; int x; cin >> x; player[x].know = 1; Sleep(2000); system("cls"); print(1, 1); cout << "他的身份是:"; if (player[x].name == "狼人 ") cout << "狼人" << endl; else cout << "好人" << endl; Sleep(3000); } else { Sleep(3000); cout << "请问你想查验谁???" << endl; Sleep(3000); system("cls"); print(1, 1); cout << "他的身份是:......"; Sleep(3000); } Sleep(3000); system("cls"); print(1, 1); cout << "预~言~家~请~闭~眼~~~" << endl; } Sleep(3000); if (kill1 != 0) player[kill1].life = 0; if (kill2 != 0) player[kill2].life = 0; player[kill1].how = 1; player[kill2].how = 3; system("cls"); system("color F0"); print(2, 0); } void night2(int hhh, int hhhh) { system("cls"); system("color 0f"); print(hhh, hhhh); cout << "天~黑~请~闭~眼~~~" << endl; if (n >= 12) shoushui(hhh, hhhh); Sleep(3000); system("cls"); print(hhh, hhhh); cout << "狼~人~请~睁~眼~~~" << endl; if (player[MY].name == "狼人 " && player[MY].life == 1) { Sleep(3000); cout << endl << "请问你们要杀谁:" << endl << "输入:"; cin >> kill1; Sleep(1500); system("cls"); print(hhh, hhhh); cout << "今晚你们要杀的是" << kill1 << "号玩家" << endl; } else { Sleep(4000); system("cls"); print(hhh, hhhh); cout << "请问你们要杀谁?" << endl; do { srand(time(0)); int x = rand() % n + 1; if (player[x].name != "狼人 " && player[x].life == 1) { kill1 = x; break; } } while (1); Sleep(5000); } Sleep(3000); system("cls"); print(hhh, hhhh); cout << "狼~人~请~闭~眼~~~" << endl; Sleep(2000); system("cls"); print(hhh, hhhh); cout << "女~巫~请~睁~眼~~~" << endl; Sleep(2000); system("cls"); print(hhh, hhhh); if (player[MY].name == "女巫 " && player[MY].life == 1) { Sleep(1000); if (jieyao == 1) { cout << "今晚" << kill1 << "号玩家被杀" << endl; Sleep(500); cout << "请问你要救吗???" << endl << "A. 救 B.不救" << endl << "输入:"; cin >> a; if (a == 'A') { system("cls"); print(hhh, hhhh); cout << "请问你要毒吗???" << endl; Sleep(2000); system("cls"); print(hhh, hhhh); cout << "今晚" << kill1 << "号玩家被你解救" << endl; jieyao = 0; if (shou != kill1) kill1 = 0; } else { if (shou == kill1) kill1 = 0; Sleep(2000); system("cls"); print(hhh, hhhh); cout << "请问你要毒吗???" << endl << "A. 毒 B.不毒" << endl << "输入:"; cin >> a; if (a == 'A') { cout << "请问你要毒谁???" << endl << "输入:"; cin >> kill2; while (player[kill2].life != 1) { cout << "输入错误,请重新输入:" << endl; cin >> kill2; } duyao = 0; } } } else if (duyao == 1) { if (shou == kill1) kill1 = 0; Sleep(2000); system("cls"); print(hhh, hhhh); cout << "请问你要毒吗???" << endl << "A. 毒 B.不毒" << endl << "输入:"; cin >> a; if (a == 'A') { cout << "请问你要毒谁???" << endl << "输入:"; cin >> kill2; while (player[kill2].life != 1) { cout << "输入错误,请重新输入:" << endl; cin >> kill2; } duyao = 0; } } else { Sleep(2000); system("cls"); print(hhh, hhhh); cout << "请问你要毒吗???" << endl; } } else { bool b = 0; cout << "请问你是否要用解药???" << endl; int FFF = 0, kkkk; for (int i = 1; i <= n; i++) { if (player[i].life == 1 && player[i].name == "村民 ") FFF++; if (player[i].name == "女巫 ") kkkk = i; } if (jieyao == 1 && player[kkkk].life == 1) { if (FFF == 1) { if (shou == kill1) jieyao = 1; else jieyao = 0; kill1 = 0; b = 1; } else for (int i = 1; i <= n; i++) { if (player[i].name == "女巫 " && kill1 == i) { kill1 = 0; if (shou == kill1) jieyao = 1; else jieyao = 0; b = 1; break; } else if (player[i].name == "预言家 " && kill1 == i) { kill1 = 0; if (shou == kill1) jieyao = 1; else jieyao = 0; b = 1; break; } } } Sleep(3000); if (b == 0 && duyao == 1 && player[kkkk].life == 1) { system("cls"); print(hhh, hhhh); cout << "请问你是否要用毒药???" << endl; srand(time(0)); int x = rand() % 2; Sleep(1500); cout << "请问你要毒谁???" << endl; if (x == 1) { duyao = 0; int y = rand() % n + 1; while ((player[y].name == "女巫 " || player[y].name == "预言家 " || y == kill1) || player[y].life == 0) y = rand() % n + 1; kill2 = y; } } else { Sleep(3000); system("cls"); print(hhh, hhhh); cout << "请问你是否要用毒药???" << endl; Sleep(3000); cout << "请问你要毒谁???" << endl; Sleep(3000); } } Sleep(3000); system("cls"); print(hhh, hhhh); cout << "女~巫~请~闭~眼~~~" << endl; if (n > 6) { Sleep(3000); system("cls"); print(hhh, hhhh); cout << "预~言~家~请~睁~眼~~~" << endl; if (player[MY].name == "预言家 " && player[MY].life == 1) { Sleep(3000); cout << "请问你想查验谁???" << endl << "输入:"; int x; cin >> x; player[x].know = 1; Sleep(2000); system("cls"); print(hhh, hhhh); cout << "他的身份是:"; if (player[x].name == "狼人 ") cout << "狼人" << endl; else cout << "好人" << endl; Sleep(3000); } else { Sleep(3000); cout << "请问你想查验谁???" << endl; Sleep(3000); system("cls"); print(hhh, hhhh); cout << "他的身份是:......"; Sleep(3000); } Sleep(3000); system("cls"); print(hhh, hhhh); cout << "预~言~家~请~闭~眼~~~" << endl; } Sleep(3000); if (kill1 != 0) player[kill1].life = 0; if (kill2 != 0) player[kill2].life = 0; player[kill1].how = 1; player[kill2].how = 3; system("cls"); system("color F0"); print(hhh + 1, 0); } bool lr = 0; void panduanlieren() { if (lr == 1) return; if (MY == lieren) { cout << "请射杀一名玩家" << endl; int x; cin >> x; while (player[x].life != 1) { cout << "输入错误,请重新输入" << endl; cin >> x; } Sleep(1000); cout << lieren << "号猎人发动技能,开枪带走了" << x << "号" << endl; player[x].life = 0; player[x].how = 4; } else if (n >= 9) { srand(time(0)); int x = rand() % n + 1; while (player[x].life != 1) { x = rand() % n + 1; } Sleep(1000); cout << lieren << "号猎人发动技能,开枪带走了" << x << "号" << endl; player[x].life = 0; player[x].how = 4; } lr = 1; } void print1() { cout << "天亮了,昨晚"; if (kill1 != 0 || kill2 != 0) { cout << kill1 << "号"; if (kill2 != 0) { cout << "," << kill2 << "号"; kill2 = 0; } cout << "被杀" << endl; } else cout << "是平安夜" << endl; } int main() { system("cls"); cout << " " << "狼人杀online" << endl; cout << "请输入人数个数:" << endl; scanf("%d", &n); cout << "加载时间长,请耐心等待"; init1(); init2(n); int k = 1; do { srand(time(0)); init3(k); cout << "."; Sleep(17); k++; } while (k <= n); system("cls"); system("color F0"); cout << "游戏即将开始"; for (int i = 1; i <= 6; i++) { cout << "."; Sleep(500); } Sleep(1500); cout << endl << endl << "请大家查看身份牌......" << endl; Sleep(45); srand(time(0)); MY = rand() % n + 1; cout << "您的身份是:" << player[MY].name << endl; Sleep(500); cout << "在" << player[MY].num << "号位上" << endl; system("pause"); system("cls"); player[MY].know = 2; print(1, 0); cout << "即将进入夜晚"; for (int i = 1; i <= 6; i++) { cout << "."; Sleep(500); } night(); print1(); if (game_over()) { Sleep(1000); system("cls"); cout << "游戏结束" << endl; printhhh(); return 0; } if (player[lieren].life == 0 && lr == 0) { panduanlieren(); } if (game_over()) { Sleep(1000); system("cls"); cout << "游戏结束" << endl; printhhh(); return 0; } toupiao(2, 0); system("cls"); print(2, 0); if (game_over()) { Sleep(1000); system("cls"); cout << "游戏结束" << endl; printhhh(); return 0; } else if (player[lieren].life == 0 && lr == 0) { panduanlieren(); } cout << "即将进入夜晚"; for (int i = 1; i <= 6; i++) { cout << "."; Sleep(500); } night2(2, 1); print1(); if (game_over()) { Sleep(1000); system("cls"); cout << "游戏结束" << endl; printhhh(); return 0; } if (player[lieren].life == 0 && lr == 0) { panduanlieren(); } if (game_over()) { Sleep(1000); system("cls"); cout << "游戏结束" << endl; printhhh(); return 0; } toupiao(3, 0); system("cls"); print(3, 0); if (game_over()) { Sleep(1000); system("cls"); cout << "游戏结束" << endl; printhhh(); return 0; } else if (player[lieren].life == 0 && lr == 0) { panduanlieren(); } cout << "即将进入夜晚"; for (int i = 1; i <= 6; i++) { cout << "."; Sleep(500); } night2(3, 1); print1(); if (game_over()) { Sleep(1000); system("cls"); cout << "游戏结束" << endl; printhhh(); return 0; } if (player[lieren].life == 0) { panduanlieren(); } if (game_over()) { Sleep(1000); system("cls"); cout << "游戏结束" << endl; printhhh(); return 0; } toupiao(4, 0); system("cls"); print(4, 0); if (game_over()) { Sleep(1000); system("cls"); cout << "游戏结束" << endl; printhhh(); return 0; } else if (player[lieren].life == 0 && lr == 0) { panduanlieren(); } if (game_over()) { Sleep(1000); system("cls"); cout << "游戏结束" << endl; printhhh(); return 0; } cout << "即将进入夜晚"; for (int i = 1; i <= 6; i++) { cout << "."; Sleep(500); } night2(4, 1); print1(); if (game_over()) { Sleep(1000); system("cls"); cout << "游戏结束" << endl; printhhh(); return 0; } if (player[lieren].life == 0) { panduanlieren(); } if (game_over()) { Sleep(1000); system("cls"); cout << "游戏结束" << endl; printhhh(); return 0; } toupiao(5, 0); system("cls"); print(5, 0); if (game_over()) { Sleep(1000); system("cls"); cout << "游戏结束" << endl; printhhh(); return 0; } else if (player[lieren].life == 0 && lr == 0) { panduanlieren(); } if (game_over()) { Sleep(1000); system("cls"); cout << "游戏结束" << endl; printhhh(); return 0; } cout << "即将进入夜晚"; for (int i = 1; i <= 6; i++) { cout << "."; Sleep(500); } night2(5, 1); print1(); if (game_over()) { Sleep(1000); system("cls"); cout << "游戏结束" << endl; printhhh(); return 0; } if (player[lieren].life == 0) { panduanlieren(); } if (game_over()) { Sleep(1000); system("cls"); cout << "游戏结束" << endl; printhhh(); return 0; } toupiao(6, 0); system("cls"); print(6, 0); if (game_over()) { Sleep(1000); system("cls"); cout << "游戏结束" << endl; printhhh(); return 0; } else if (player[lieren].life == 0 && lr == 0) { panduanlieren(); } if (game_over()) { Sleep(1000); system("cls"); cout << "游戏结束" << endl; printhhh(); return 0; } cout << "即将进入夜晚"; for (int i = 1; i <= 6; i++) { cout << "."; Sleep(500); } night2(6, 1); print1(); if (game_over()) { Sleep(1000); system("cls"); cout << "游戏结束" << endl; printhhh(); return 0; } if (player[lieren].life == 0) { panduanlieren(); } if (game_over()) { Sleep(1000); system("cls"); cout << "游戏结束" << endl; printhhh(); return 0; } toupiao(7, 0); system("cls"); print(7, 0); if (game_over()) { Sleep(1000); system("cls"); cout << "游戏结束" << endl; printhhh(); return 0; } else if (player[lieren].life == 0 && lr == 0) { panduanlieren(); } if (game_over()) { Sleep(1000); system("cls"); cout << "游戏结束" << endl; printhhh(); return 0; } while (1) system("pause"); return 0; }
-
通过的题目
- 1
- 2
- 3
- 5
- 6
- 7
- 8
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 26
- 28
- 32
- 33
- 34
- 35
- 37
- 42
- 48
- 49
- 55
- 59
- 62
- 64
- 66
- 70
- 80
- 81
- 90
- 91
- 93
- 95
- 97
- 100
- 103
- 104
- 106
- 107
- 108
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 124
- 130
- 135
- 146
- 147
- 152
- 158
- 159
- 164
- 173
- 176
- 177
- 184
- 188
- 190
- 197
- 205
- 206
- 208
- 213
- 217
- 229
- 233
- 241
- 246
- 265
- 297
- 309
- 364
- 368
- 371
- 381
- 383
- 401
- 443
- 451
- 454
- 457
- 465
- 466
- 467
- 484
- 495
- 499
- 502
- 512
- 516
- 518
- 521
- 529
- 541
- 553
- 561
- 576
- 577
- 583
- 586
- 606
- 607
- 609
- 614
- 620
- 635
- 641
- 651
- 652
- 660
- 670
- 677
- 678
- 686
- 691
- 692
- 697
- 701
- 702
- 703
- 704
- 710
- 712
- 715
- 739
- 744
- 755
- 779
- 785
- 788
- 790
- 806
- 807
- 809
- 811
- 815
- 817
- 818
- 821
- 822
- 826
- 828
- 829
- 830
- 834
- 835
- 836
- 837
- 839
- 842
- 844
- 846
- 848
- 849
- 850
- 851
- 852
- 853
- 855
- 859
- 863
- 864
- 865
- 866
- 867
- 868
- 869
- 870
- 871
- 872
- 873
- 874
- 875
- 877
- 879
- 880
- 881
- 882
- 883
- 884
- 885
- 886
- 887
- 888
- 891
- 894
- 896
- 898
- 899
- 903
- 904
- 906
- 907
- 908
- 910
- 914
- 915
- 917
- 919
- 921
- 924
- 925
- 926
- 928
- 931
- 932
- 933
- 935
- 937
- 939
- 941
- 944
- 946
- 947
- 951
- 952
- 953
- 954
- 955
- 956
- 957
- 958
- 959
- 960
- 963
- 964
- 965
- 966
- 967
- 970
- 972
- 973
- 974
- 975
- 976
- 977
- 978
- 980
- 981
- 982
- 983
- 984
- 985
- 986
- 987
- 988
- 989
- 990
- 991
- 993
- 994
- 995
- 996
- 997
- 998
- 999
- 1000
- 1002
- 1003
- 1004
- 1006
- 1007
- 1014
- 1015
- 1016
- 1017
- 1018
- 1020
- 1023
- 1024
- 1025
- 1026
- 1030
- 1031
- 1034
- 1035
- 1037
- 1038
- 1040
- 1041
- 1042
- 1043
- 1044
- 1045
- 1048
- 1049
- 1051
- 1052
- 1053
- 1055
- 1057
- 1058
- 1059
- 1062
- 1063
- 1066
- 1067
- 1070
- 1071
- 1073
- 1074
- 1075
- 1078
- 1085
- 1089
- 1090
- 1091
- 1092
- 1093
- 1095
- 1098
- 1099
- 1102
- 1104
- 1107
- 1110
- 1114
- 1115
- 1117
- 1124
- 1128
- 1131
- 1132
- 1133
- 1134
- 1135
- 1139
- 1140
- 1143
- 1149
- 1153
- 1154
- 1160
- 1162
- 1163
- 1165
- 1177
- 1178
- 1180
- 1182
- 1183
- 1184
- 1187
- 1188
- 1190
- 1191
- 1204
- 1211
- 1218
- 1221
- 1263
- 1276
- 1278
- 1319
- 1329
- 1352
- 1357
- 1358
- 1363
- 1366
- 1369
- 1373
- 1383
- 1386
- 1389
- 1390
- 1396
- 1397
- 1414
- 1415
- 1416
- 1417
- 1425
- 1427
- 1428
- 1429
- 1430
- 1431
- 1432
- 1443
- 1464
- 1469
- 1489
- 1495
- 1501
- 1502
- 1505
- 1508
- 1511
- 1514
- 1519
- 1527
- 1528
- 1547
- 1551
- 1557
- 1562
- 1564
- 1575
- 1576
- 1595
- 1621
- 1662
- 1663
- 1670
- 1678
- 1718
- 1724
- 1725
- 1727
- 1730
- 1741
- 1780
- 1829
- 1830
- 1897
- 1928
- 1929
- 1954
- 1965
- 1966
- 1981
- 2012
- 2036
- 2063
- 2073
- 2075
- 2098
- 2109
- 2110
- 2120
- 2131
- 2135
- 2142
- 2147
- 2173
- 2198
- 2211
- 2227
- 2232
- 2249
- 2258
- 2273
- 2295
- 2309
- 2346
- 2385
- 2386
- 2419
- 2433
- 2465
- 2492
- 2496
- 2503
- 2513
- 2516
- 2552
- 2553
- 2571
- 2576
- 2577
- 2589
- 2607
- 2623
- 2655
- 2665
- 2666
- 2670
- 2681
- 2720
- 2722
- 2725
- 2730
- 2738
- 2750
- 2784
- 2800
- 2813
- 2836
- 2841
- 2853
- 2860
- 2863
- 2893
- 2918
- 2923
- 2929
- 2933
- 2934
- 2938
- 2949
- 2951
- 2953
- 2956
- 2964
- 2974
- 2975
- 2982
- 2983
- 2996
- 2997
- 2998
- 2999
- 3007
- 3008
- 3009
- 3013
- 3015
- 3021
- 3029
- 3053
- 3056
- 3057
- 3058
- 3060
- 3065
- 3070
- P0140
- 3080
- 3082
- 3083
- 3090
- P0141
- 3093
- 3094
- 3102
- 3103
- 3106
- 3108
- 3116
- 3119
- 3121
- 3122
- 3124
- 3125
- 3129
- 3130
- P3133
- 3147
- 3148
- 3149
- 3150
- 3151
- 3152
- 3154
- 3157
- 3160
- 3173
- 3179
- 3180
- 3181
- 3185
- 3186
- 3190
- 3191
- 3192
- 3217
- P3225
-
最近活动
- 添胜集训day4 IOI
- 添胜集训day3 IOI
- 添胜集训day2 IOI
- 添胜数组集训day1 IOI
- 少年宫中级B2班期末综合测试 IOI
- 少年宫周六晚上中级班(20241221)【吴飞】 作业
- C++初级A1班06-字符串2 IOI
- 少年宫周六晚上中级班(20241214)【吴飞】 作业
- C++初级A1班05-排序基础 IOI
- 少年宫周六晚上中级班(20241207)【吴飞】 作业
- C++初级C2C3班06-循环结构2 IOI
- 少年宫周六晚上中级班(20241123)【吴飞】 作业
- 少年宫周六晚上中级班(20241123)【吴飞】 作业
- C++初级A1班04-字符、字符数组、字符串 IOI
- C++高级B1班03-背包DP IOI
- 少年宫周六晚上中级班(20241116)【吴飞】 作业
- C++初级A1班03-二维数组 IOI
- 少年宫周六晚上中级班(20241109)【吴飞】 作业
- C++初级C2C3班05-循环结构1 IOI
- 少年宫周六晚上中级班(20241102)【吴飞】 作业
- 少年宫周六晚上中级班(20241026)【吴飞】 作业
- C++初级C2C3班04-选择结构练习 IOI
- 少年宫周六晚上中级班(20241019)【吴飞】 作业
- C++初级C2C3班03-选择结构基础 IOI
- J组赛前模拟3 OI
- J组赛前模拟2 OI
- 少年宫周六晚上中级班(20240928)【吴飞】 作业
- J组赛前模拟7 20241001 IOI
- 少年宫周六晚上中级班(20240921)【吴飞】 作业
- C++初级A1班01-循环复习 IOI
- 2024年CSP-J模拟测试6 OI
- 2024年CSP-J模拟测试5 OI
- 2024年CSP-J模拟测试4 OI
- 2024年CSP-J模拟测试3 IOI
- 2024年CSP-J模拟测试1(出题人:黄俊鹏) IOI
- 少年宫周三下午五点班(20240320)【陈潮雄】 作业
- 少年宫周日上午十点班(20240310)【陈潮雄】 作业
- 少年宫周五下午五点班(20240308)【陈潮雄】 作业
-
最近编写的题解
题目标签
- 语言基础
- 119
- 竞赛
- 86
- 循环语句
- 72
- 年份
- 58
- 其他
- 57
- USACO
- 49
- 字符串
- 45
- 数据结构
- 39
- 搜索
- 37
- 字符数组
- 37
- NOIP
- 35
- 动态规划
- 34
- 一维数组
- 31
- 二维数组
- 29
- 选择语句
- 28
- 模拟
- 24
- 一本通
- 24
- 贪心
- 23
- 语言入门
- 21
- 普及组
- 20