一个小游戏,欢迎神犇批评
#include#include #include #include #include #include #include #define Co cout #define I int #define St string #define Ch char #define B bool #define Ci cin #define S sleep(1); #define U usleep #define C case #define Lo long long #define Le length #define V void #define F for #define W while #define Br break #define Cn continue #define SS system("cls") #define E endl using namespace std; string name; bool k=0; V zbc() { sleep(1); Co << "33[?25l"; cout << "╔══════════════════════════╗"<< endl; cout << "║ ║" << endl; cout << "║ ║" << endl; cout << "║ ║" << endl; cout << "╚══════════════════════════╝"<< endl; sleep(1); system("cls"); cout << "33[031m"; cout << "╔══════════════════════════╗"<< endl; cout << "║ ║" << endl; cout << "║ 天 ║" << endl; cout << "║ ║" << endl; cout << "╚══════════════════════════╝"<< endl; sleep(1); cout << "33[033m"; system("cls"); cout << "╔══════════════════════════╗"<< endl; cout << "║ ║" << endl; cout << "║ 天 秀 ║" << endl; cout << "║ ║" << endl; cout << "╚══════════════════════════╝"<< endl; sleep(1); cout << "33[034m"; system("cls"); cout << "╔══════════════════════════╗"<< endl; cout << "║ ║" << endl; cout << "║ 天 秀 作 ║" << endl; cout << "║ (5. ║" << endl; cout << "╚══════════════════════════╝"<< endl; sleep(1); cout << "33[035m"; system("cls"); cout << "╔══════════════════════════╗"<< endl; cout << "║ ║" << endl; cout << "║ 天 秀 作 品 ║" << endl; cout << "║ (5.2 ║" << endl; cout << "╚══════════════════════════╝"<< endl; sleep(1); cout << "33[036m"; system("cls"); cout << "╔══════════════════════════╗"<< endl; cout << "║ * * ║" << endl; cout << "║ 天 秀 作 品 ║" << endl; cout << "║ (5.3版) ║" << endl; cout << "╚══════════════════════════╝"<< endl; sleep(3); } int j=1; void p(const string a) { size_t len = a.size(); for(int i = 0; i < a.size(); i++) { cout << a[i]; usleep(5000); } } void jdb(char a) { if(a=='o') { p("恭喜一号玩家胜利!!!n"); sleep(1); } else { p("恭喜二号玩家胜利!!!n"); sleep(1); } } void print(char a,char b,char c,char d,char e,char f,char j,char h,char i) { cout << "+---+---+---+" << endl; cout << "│ " << a << " │ " << b << " │ " << c << " │" << endl; cout << "+---+---+---+" << endl; cout << "│ " << d << " │ " << e << " │ " << f << " │" << endl; cout << "+---+---+---+" << endl; cout << "│ " << j << " │ " << h << " │ " << i << " │" << endl; cout << "+---+---+---+" << endl; } void sj() { char c[9] = {'1', '2', '3', '4', '5', '6', '7', '8', '9'}; system("cls"); print(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8]); for (int i = 1; i <= 9; i++) { if (i % 2 == 1) { cout << "请1号玩家输入下棋位置:"; int n; cin >> n; if (c[n - 1] == 'o'||c[n - 1] == 'x') { p("落子错误n"); sleep(1); break; } c[n - 1] = 'o'; } else { cout << "请2号玩家输入下棋位置:"; int n; cin >> n; if (c[n - 1] == 'o'||c[n - 1] == 'x') { p("落子错误n"); sleep(1); break; } c[n - 1] = 'x'; } system("cls"); print(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8]); if (c[0]==c[4]&&c[4]==c[6]&&c[6]!=' ') { jdb(c[0]); break; } if (c[2]==c[4]&&c[4]==c[8]&&c[8]!=' ') { jdb(c[2]); break; } if (c[0]==c[2]&&c[2]==c[4]&&c[4]!=' ') { jdb(c[0]); break; } if (c[4]==c[6]&&c[6]==c[8]&&c[8]!=' ') { jdb(c[4]); break; } if (c[1]==c[5]&&c[5]==c[7]&&c[7]!=' ') { jdb(c[1]); break; } if (c[1]==c[3]&&c[3]==c[7]&&c[7]!=' ') { jdb(c[1]); break; } if (c[3]==c[5]&&c[5]==c[7]&&c[7]!=' ') { jdb(c[3]); break; } if (c[1]==c[3]&&c[3]==c[5]&&c[5]!=' ') { jdb(c[1]); break; } if(i==9) { p("势均力敌n"); sleep(1); } } } void pt() { char c[9] = {'1', '2', '3', '4', '5', '6', '7', '8', '9'}; system("cls"); print(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8]); for (int i = 1; i <= 9; i++) { if (i % 2 == 1) { cout << "请1号玩家输入下棋位置:"; int n; cin >> n; if (c[n - 1] == 'o'||c[n - 1] == 'x') { cout << "落子错误" << endl; sleep(2); break; } c[n - 1] = 'o'; } else { cout << "请2号玩家输入下棋位置:"; int n; cin >> n; if (c[n - 1] == 'o'||c[n - 1] == 'x') { cout << "落子错误" << endl; sleep(2); break; } c[n - 1] = 'x'; } system("cls"); print(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8]); if (c[0] == c[1] && c[1] == c[2] && c[2] != ' ') { jdb(c[0]); break; } if (c[3] == c[4] && c[4] == c[5] && c[5] != ' ') { jdb(c[3]); break; } if (c[6] == c[7] && c[7] == c[8] && c[8] != ' ') { jdb(c[6]); break; } if (c[0] == c[3] && c[3] == c[6] && c[6] != ' ') { jdb(c[0]); break; } if (c[1] == c[4] && c[4] == c[7] && c[7] != ' ') { jdb(c[1]); break; } if (c[2] == c[5] && c[5] == c[8] && c[8] != ' ') { jdb(c[2]); break; } if (c[0] == c[4] && c[4] == c[8] && c[8] != ' ') { jdb(c[0]); break; } if (c[2] == c[4] && c[4] == c[6] && c[2] != ' ') { jdb(c[2]); break; } if(i==9) { p("势均力敌n"); sleep(1); } } } void jzq() { system("cls"); p("井字棋玩法:两个人一起玩,普通模式不用说,三角模式就是把棋子摆成三角(O是一号玩家的棋子,X是二号玩家的棋子n"); while(1) { int b=0; if(j!=1) { system("cls"); p("你还要玩吗?n"); p("1.要(输入1)2.不要(输入2)n"); p("温馨提示:不要太贪玩,因为系统会说输出超长n"); cin>>b; } if(b==1||j==1) { j++; p("你要玩哪种模式的井字棋呢?n"); p("1.普通模式(输入1)2.三角模式(输入2)n"); int a; cin>>a; if(a==1) { pt(); } else if(a==2) { sj(); } else { p("你到底玩不玩啊!!!n"); sleep(1); } } else if(b==2) { p("GOODBYE!下次再来n"); sleep(1); break; } else { p("你到底玩不玩啊!!!n"); sleep(1); break; } } } void tkd2() { system("cls"); bool q; char map[10][10] = { {'O',' ',' ',' ',' ',' ',' ',' ','%','z'}, {'%',' ','%','z',' ','%','z',' ','%','z'}, {'z',' ','%','z',' ','%','z',' ','%','z'}, {' ',' ','%','z',' ','%','z',' ','%','z'}, {'%',' ','%','z',' ','%','z',' ','%','z'}, {'z',' ','%','z',' ','%','z',' ','%','z'}, {' ',' ','%','z',' ','%','z',' ','%','z'}, {'%',' ','%','z',' ','%','z',' ','%','z'}, {'z',' ','%','z',' ','%','z',' ','%','z'}, {' ',' ','%','z',' ','%','z',' ','%','z'} }; for (int i = 0; i <= 9; i++) { for (int j = 0; j <= 9; j++) { cout << map[i][j]; } cout< > ch; if(ch == 'w' || ch == 'W') { if (map[x-1][y] == ' ') { map[x][y] = ' '; map[x - 1][y] = 'O'; } if (map[x - 1][y] == '%') { if (map[x - 2][y] == ' ' || map[x - 2][y] == 'z') { map[x - 2][y] = '%'; map[x - 1][y] = 'O'; map[x][y] = ' '; } } } if (ch == 's' || ch == 'S') { if (map[x + 1][y] == ' ') { map[x][y] = ' '; map[x + 1][y] = 'O'; } if (map[x + 1][y] == '%') { if (map[x + 2][y] == ' ' || map[x + 2][y] == 'z') { map[x + 2][y] = '%'; map[x + 1][y] = 'O'; map[x][y] = ' '; } } } if(ch == 'a' || ch == 'A') { if (map[x][y - 1] == ' ') { map[x][y] = ' '; map[x][y - 1] = 'O'; } if (map[x][y - 1] == '%') { if ( map[x][y - 2] == ' ' || map[x][y - 2] == 'z') { map[x][y - 2] = '%'; map[x][y - 1] = 'O'; map[x][y] = ' '; } } } if (ch == 'd' || ch == 'D') { if (map[x][y + 1] == ' ') { map[x][y] = ' '; map[x][y + 1] = 'O'; } if (map[x][y + 1] == '%') { if (map[x][y + 2] == ' ' || map[x][y + 2] == 'z') { map[x][y + 2] = '%'; map[x][y + 1] = 'O'; map[x][y] = ' '; } } } if (ch=='q') { tkd2(); } system("cls"); for (int i = 0; i <= 9; i ++) { for (int j = 0; j <= 9; j++) { cout << map[i][j]; } cout << endl; } for (int i = 0; i <= 9; i ++) { for (int j = 0; j <= 9; j++) { if(map[i][j]=='z') { q=1; } } } if (q==0) { p("恭喜你把箱子推回了原位,坑不坑?你竟然通过了最难关卡,太牛了!n"); sleep(1); break; } } } void tkd() { system("cls"); char map[5][5] = { {'O',' ','#','#','#'}, {'#',' ',' ',' ','#'}, {'#',' ','%',' ',' '}, {'#',' ',' ','#','#'}, {'#','#','#','#','z'} }; for (int i = 0; i <= 4; i++) { for (int j = 0; j <= 4; j++) { cout << map[i][j]; } cout< > ch; if(ch == 'w' || ch == 'W') { if (map[x-1][y] == ' ') { map[x][y] = ' '; map[x - 1][y] = 'O'; } if (map[x - 1][y] == '%') { if (map[x - 2][y] == ' ' || map[x - 2][y] == 'z') { map[x - 2][y] = '%'; map[x - 1][y] = 'O'; map[x][y] = ' '; } } } if (ch == 's' || ch == 'S') { if (map[x + 1][y] == ' ') { map[x][y] = ' '; map[x + 1][y] = 'O'; } if (map[x + 1][y] == '%') { if (map[x + 2][y] == ' ' || map[x + 2][y] == 'z') { map[x + 2][y] = '%'; map[x + 1][y] = 'O'; map[x][y] = ' '; } } } if(ch == 'a' || ch == 'A') { if (map[x][y - 1] == ' ') { map[x][y] = ' '; map[x][y - 1] = 'O'; } if (map[x][y - 1] == '%') { if ( map[x][y - 2] == ' ' || map[x][y - 2] == 'z') { map[x][y - 2] = '%'; map[x][y - 1] = 'O'; map[x][y] = ' '; } } } if (ch == 'd' || ch == 'D') { if (map[x][y + 1] == ' ') { map[x][y] = ' '; map[x][y + 1] = 'O'; } if (map[x][y + 1] == '%') { if (map[x][y + 2] == ' ' || map[x][y + 2] == 'z') { map[x][y + 2] = '%'; map[x][y + 1] = 'O'; map[x][y] = ' '; } } } if (ch=='q') { tkd(); break; } system("cls"); for (int i = 0; i <= 4; i ++) { for (int j = 0; j <= 4; j++) { cout << map[i][j]; } cout << endl; } if (map[3][1]=='%') { tkd2(); break; } } } void tdifficult() { system("cls"); char map[10][10] = { {'O',' ','#','#','#','#','#',' ',' ','z'}, {'#',' ',' ',' ',' ',' ',' ',' ','#','#'}, {'#',' ','#',' ','#',' ','#',' ',' ','#'}, {'#',' ',' ',' ',' ',' ','#',' ','#','#'}, {'#','#',' ','#','#',' ',' ','%',' ','#'}, {'#',' ','%',' ',' ',' ','#','#',' ','#'}, {'#',' ',' ',' ','#',' ','#',' ',' ','#'}, {'#',' ','#',' ','#','%','#','#',' ','#'}, {'#','#','#',' ','#',' ','#',' ',' ','#'}, {'z',' ',' ',' ',' ',' ',' ',' ',' ','z'} }; for (int i = 0; i <= 9; i++) { for (int j = 0; j <= 9; j++) { cout << map[i][j]; } cout< > ch; if(ch == 'w' || ch == 'W') { if (map[x-1][y] == ' ') { map[x][y] = ' '; map[x - 1][y] = 'O'; } if (map[x - 1][y] == '%') { if (map[x - 2][y] == ' ' || map[x - 2][y] == 'z') { map[x - 2][y] = '%'; map[x - 1][y] = 'O'; map[x][y] = ' '; } } } if (ch == 's' || ch == 'S') { if (map[x + 1][y] == ' ') { map[x][y] = ' '; map[x + 1][y] = 'O'; } if (map[x + 1][y] == '%') { if (map[x + 2][y] == ' ' || map[x + 2][y] == 'z') { map[x + 2][y] = '%'; map[x + 1][y] = 'O'; map[x][y] = ' '; } } } if(ch == 'a' || ch == 'A') { if (map[x][y - 1] == ' ') { map[x][y] = ' '; map[x][y - 1] = 'O'; } if (map[x][y - 1] == '%') { if ( map[x][y - 2] == ' ' || map[x][y - 2] == 'z') { map[x][y - 2] = '%'; map[x][y - 1] = 'O'; map[x][y] = ' '; } } } if (ch == 'd' || ch == 'D') { if (map[x][y + 1] == ' ') { map[x][y] = ' '; map[x][y + 1] = 'O'; } if (map[x][y + 1] == '%') { if (map[x][y + 2] == ' ' || map[x][y + 2] == 'z') { map[x][y + 2] = '%'; map[x][y + 1] = 'O'; map[x][y] = ' '; } } } if (ch=='q') { tdifficult(); } system("cls"); for (int i = 0; i <= 9; i ++) { for (int j = 0; j <= 9; j++) { cout << map[i][j]; } cout << endl; } if (map[9][9]=='%'&&map[9][0]=='%'&&map[0][9]=='%') { p("恭喜你把箱子推回了原位,你竟然闯过了困难关卡,厉害啊,去挑战更难的关卡吧n"); sleep(1); break; } } } void tmiddle() { system("cls"); char map[8][8] = { {'O',' ','#','#','#','#','#','#'}, {'#',' ',' ',' ',' ',' ',' ',' '}, {'#',' ','#','%','#',' ','#',' '}, {'#',' ',' ',' ',' ',' ','#',' '}, {'#','#','#','#','#',' ','#',' '}, {'#',' ',' ',' ',' ','%','#',' '}, {'#',' ',' ',' ',' ',' ',' ',' '}, {'z',' ',' ','#','#','#','#','z'} }; for (int i = 0; i <= 7; i++) { for (int j = 0; j <= 7; j++) { cout << map[i][j]; } cout< > ch; if(ch == 'w' || ch == 'W') { if (map[x-1][y] == ' ') { map[x][y] = ' '; map[x - 1][y] = 'O'; } if (map[x - 1][y] == '%') { if (map[x - 2][y] == ' ' || map[x - 2][y] == 'z') { map[x - 2][y] = '%'; map[x - 1][y] = 'O'; map[x][y] = ' '; } } } if (ch == 's' || ch == 'S') { if (map[x + 1][y] == ' ') { map[x][y] = ' '; map[x + 1][y] = 'O'; } if (map[x + 1][y] == '%') { if (map[x + 2][y] == ' ' || map[x + 2][y] == 'z') { map[x + 2][y] = '%'; map[x + 1][y] = 'O'; map[x][y] = ' '; } } } if(ch == 'a' || ch == 'A') { if (map[x][y - 1] == ' ') { map[x][y] = ' '; map[x][y - 1] = 'O'; } if (map[x][y - 1] == '%') { if ( map[x][y - 2] == ' ' || map[x][y - 2] == 'z') { map[x][y - 2] = '%'; map[x][y - 1] = 'O'; map[x][y] = ' '; } } } if (ch == 'd' || ch == 'D') { if (map[x][y + 1] == ' ') { map[x][y] = ' '; map[x][y + 1] = 'O'; } if (map[x][y + 1] == '%') { if (map[x][y + 2] == ' ' || map[x][y + 2] == 'z') { map[x][y + 2] = '%'; map[x][y + 1] = 'O'; map[x][y] = ' '; } } } if (ch=='q') { tmiddle(); } system("cls"); for (int i = 0; i <= 7; i ++) { for (int j = 0; j <= 7; j++) { cout << map[i][j]; } cout << endl; } if (map[7][7]=='%'&&map[7][0]=='%') { p("恭喜你把箱子推回了原位,普通虽然有点难,但也不算什么,去挑战更难的关卡吧n"); sleep(1); break; } } } void teasy() { system("cls"); char map[5][5] = { {'O',' ','#','#','#'}, {'#',' ',' ',' ','#'}, {'#',' ','%',' ',' '}, {'#',' ',' ',' ',' '}, {'#','#','#','#','z'} }; for (int i = 0; i <= 4; i++) { for (int j = 0; j <= 4; j++) { cout << map[i][j]; } cout< > ch; if(ch == 'w' || ch == 'W') { if (map[x-1][y] == ' ') { map[x][y] = ' '; map[x - 1][y] = 'O'; } if (map[x - 1][y] == '%') { if (map[x - 2][y] == ' ' || map[x - 2][y] == 'z') { map[x - 2][y] = '%'; map[x - 1][y] = 'O'; map[x][y] = ' '; } } } if (ch == 's' || ch == 'S') { if (map[x + 1][y] == ' ') { map[x][y] = ' '; map[x + 1][y] = 'O'; } if (map[x + 1][y] == '%') { if (map[x + 2][y] == ' ' || map[x + 2][y] == 'z') { map[x + 2][y] = '%'; map[x + 1][y] = 'O'; map[x][y] = ' '; } } } if(ch == 'a' || ch == 'A') { if (map[x][y - 1] == ' ') { map[x][y] = ' '; map[x][y - 1] = 'O'; } if (map[x][y - 1] == '%') { if ( map[x][y - 2] == ' ' || map[x][y - 2] == 'z') { map[x][y - 2] = '%'; map[x][y - 1] = 'O'; map[x][y] = ' '; } } } if (ch == 'd' || ch == 'D') { if (map[x][y + 1] == ' ') { map[x][y] = ' '; map[x][y + 1] = 'O'; } if (map[x][y + 1] == '%') { if (map[x][y + 2] == ' ' || map[x][y + 2] == 'z') { map[x][y + 2] = '%'; map[x][y + 1] = 'O'; map[x][y] = ' '; } } } if (ch=='q') { teasy(); } system("cls"); for (int i = 0; i <= 4; i ++) { for (int j = 0; j <= 4; j++) { cout << map[i][j]; } cout << endl; } if (map[4][4]=='%') { p("恭喜你把箱子推回了原位,普通虽然难了一些,但也不算什么,去挑战更难的关卡吧n"); sleep(1); break; } } } void txz() { system("cls"); p("推箱子玩法:把箱子推到终点(O是你,%是箱子)n"); while(1) { int b=0; if(j!=1) { system("cls"); p("你还要玩吗?n"); p("1.要(输入1)2.不要(输入2)n"); p("温馨提示:不要太贪玩,因为系统会说输出超长n"); cin>>b; } if(b==1||j==1) { j++; p("你要玩哪种难度的推箱子呢?n"); p("1.简单(输入1)2.普通(输入2)3.困难(输入3)4.坑爹(输入4)n"); int a; cin>>a; if(a==1) { teasy(); } else if(a==2) { tmiddle(); } else if(a==3) { tdifficult(); } else if(a==4) { tkd(); } else { p("你到底玩不玩啊!!!n"); sleep(1); } } else if(b==2) { p("GOODBYE!下次再来n"); sleep(1); break; } else { p("你到底玩不玩啊!!!n"); sleep(1); break; } } } void db(int a,int b) { system("cls"); if(a>b) { p("恭喜一号玩家获得胜利!开心不开心!赢了"); cout<> ch; if (ch == 's' && map[x1 + 1][y1] != '#') { if (map[x1 + 1][y1] == '*') { c1++; } map[x1][y1] = ' '; x1++; map[x1][y1] = 'O'; } if (ch == 'w' && map[x1 - 1][y1] != '#') { if (map[x1 - 1][y1] == '*') { c1++; } map[x1][y1] = ' '; x1--; map[x1][y1] = 'O'; } if (ch == 'a' && map[x1][y1 - 1] != '#') { if (map[x1][y1 - 1] == '*') { c1++; } map[x1][y1] = ' '; y1--; map[x1][y1] ='O'; } if (ch == 'd' && map[x1][y1 + 1] != '#') { if (map[x1][y1 + 1] == '*') { c1++; } map[x1][y1] = ' '; y1++; map[x1][y1] = 'O'; } system("cls"); for (int i = 0; i <= 5; i ++) { for (int j = 0; j <= 5; j++) { cout << map[i][j]; } cout << endl; } cout<<"一号玩家吃了"< > sh; if (sh == 'k' && map[x2 + 1][y2] != '#') { if (map[x2 + 1][y2] == '*') { c2++; } map[x2][y2] = ' '; x2++; map[x2][y2] = 'X'; } if (sh == 'i' && map[x2 - 1][y2] != '#') { if (map[x2 - 1][y2] == '*') { c2++; } map[x2][y2] = ' '; x2--; map[x2][y2] = 'X'; } if (sh == 'j' && map[x2][y2 - 1] != '#') { if (map[x2][y2 - 1] == '*') { c2++; } map[x2][y2] = ' '; y2--; map[x2][y2] ='X'; } if (sh == 'l' && map[x2][y2 + 1] != '#') { if (map[x2][y2 + 1] == '*') { c2++; } map[x2][y2] = ' '; y2++; map[x2][y2] = 'X'; } system("cls"); for (int i = 0; i <= 5; i ++) { for (int j = 0; j <= 5; j++) { cout << map[i][j]; } cout << endl; } cout<<"一号玩家吃了"< > ch; if (ch == 's' && map[x1 + 1][y1] != '#') { if (map[x1 + 1][y1] == '*') { c1++; } map[x1][y1] = ' '; x1++; map[x1][y1] = 'O'; } if (ch == 'w' && map[x1 - 1][y1] != '#') { if (map[x1 - 1][y1] == '*') { c1++; } map[x1][y1] = ' '; x1--; map[x1][y1] = 'O'; } if (ch == 'a' && map[x1][y1 - 1] != '#') { if (map[x1][y1 - 1] == '*') { c1++; } map[x1][y1] = ' '; y1--; map[x1][y1] ='O'; } if (ch == 'd' && map[x1][y1 + 1] != '#') { if (map[x1][y1 + 1] == '*') { c1++; } map[x1][y1] = ' '; y1++; map[x1][y1] = 'O'; } system("cls"); for (int i = 0; i <= 5; i ++) { for (int j = 0; j <= 5; j++) { cout << map[i][j]; } cout << endl; } cout<<"一号玩家吃了"< > sh; if (sh == 'k' && map[x2 + 1][y2] != '#') { if (map[x2 + 1][y2] == '*') { c2++; } map[x2][y2] = ' '; x2++; map[x2][y2] = 'X'; } if (sh == 'i' && map[x2 - 1][y2] != '#') { if (map[x2 - 1][y2] == '*') { c2++; } map[x2][y2] = ' '; x2--; map[x2][y2] = 'X'; } if (sh == 'j' && map[x2][y2 - 1] != '#') { if (map[x2][y2 - 1] == '*') { c2++; } map[x2][y2] = ' '; y2--; map[x2][y2] ='X'; } if (sh == 'l' && map[x2][y2 + 1] != '#') { if (map[x2][y2 + 1] == '*') { c2++; } map[x2][y2] = ' '; y2++; map[x2][y2] = 'X'; } system("cls"); for (int i = 0; i <= 5; i ++) { for (int j = 0; j <= 5; j++) { cout << map[i][j]; } cout << endl; } cout<<"一号玩家吃了"< > ch; if (ch == 's' && map[x1 + 1][y1] != '#') { if (map[x1 + 1][y1] == '*') { c1++; } map[x1][y1] = ' '; x1++; map[x1][y1] = 'O'; } if (ch == 'w' && map[x1 - 1][y1] != '#') { if (map[x1 - 1][y1] == '*') { c1++; } map[x1][y1] = ' '; x1--; map[x1][y1] = 'O'; } if (ch == 'a' && map[x1][y1 - 1] != '#') { if (map[x1][y1 - 1] == '*') { c1++; } map[x1][y1] = ' '; y1--; map[x1][y1] ='O'; } if (ch == 'd' && map[x1][y1 + 1] != '#') { if (map[x1][y1 + 1] == '*') { c1++; } map[x1][y1] = ' '; y1++; map[x1][y1] = 'O'; } system("cls"); for (int i = 0; i <= 9; i ++) { for (int j = 0; j <= 9; j++) { cout << map[i][j]; } cout << endl; } cout<<"一号玩家吃了"< > sh; if (sh == 'k' && map[x2 + 1][y2] != '#') { if (map[x2 + 1][y2] == '*') { c2++; } map[x2][y2] = ' '; x2++; map[x2][y2] = 'X'; } if (sh == 'i' && map[x2 - 1][y2] != '#') { if (map[x2 - 1][y2] == '*') { c2++; } map[x2][y2] = ' '; x2--; map[x2][y2] = 'X'; } if (sh == 'j' && map[x2][y2 - 1] != '#') { if (map[x2][y2 - 1] == '*') { c2++; } map[x2][y2] = ' '; y2--; map[x2][y2] ='X'; } if (sh == 'l' && map[x2][y2 + 1] != '#') { if (map[x2][y2 + 1] == '*') { c2++; } map[x2][y2] = ' '; y2++; map[x2][y2] = 'X'; } system("cls"); for (int i = 0; i <= 9; i ++) { for (int j = 0; j <= 9; j++) { cout << map[i][j]; } cout << endl; } cout<<"一号玩家吃了"< > ch; if (ch == 's' && map[x1 + 1][y1] != '#') { if (map[x1 + 1][y1] == '*') { c1++; } map[x1][y1] = ' '; x1++; map[x1][y1] = 'O'; } if (ch == 'w' && map[x1 - 1][y1] != '#') { if (map[x1 - 1][y1] == '*') { c1++; } map[x1][y1] = ' '; x1--; map[x1][y1] = 'O'; } if (ch == 'a' && map[x1][y1 - 1] != '#') { if (map[x1][y1 - 1] == '*') { c1++; } map[x1][y1] = ' '; y1--; map[x1][y1] ='O'; } if (ch == 'd' && map[x1][y1 + 1] != '#') { if (map[x1][y1 + 1] == '*') { c1++; } map[x1][y1] = ' '; y1++; map[x1][y1] = 'O'; } system("cls"); for (int i = 0; i <= 7; i ++) { for (int j = 0; j <= 7; j++) { cout << map[i][j]; } cout << endl; } cout<<"一号玩家吃了"< > sh; if (sh == 'k' && map[x2 + 1][y2] != '#') { if (map[x2 + 1][y2] == '*') { c2++; } map[x2][y2] = ' '; x2++; map[x2][y2] = 'X'; } if (sh == 'i' && map[x2 - 1][y2] != '#') { if (map[x2 - 1][y2] == '*') { c2++; } map[x2][y2] = ' '; x2--; map[x2][y2] = 'X'; } if (sh == 'j' && map[x2][y2 - 1] != '#') { if (map[x2][y2 - 1] == '*') { c2++; } map[x2][y2] = ' '; y2--; map[x2][y2] ='X'; } if (sh == 'l' && map[x2][y2 + 1] != '#') { if (map[x2][y2 + 1] == '*') { c2++; } map[x2][y2] = ' '; y2++; map[x2][y2] = 'X'; } system("cls"); for (int i = 0; i <= 7; i ++) { for (int j = 0; j <= 7; j++) { cout << map[i][j]; } cout << endl; } cout<<"一号玩家吃了"< > ch; if (ch == 's' && map[x1 + 1][y1] != '#') { if (map[x1 + 1][y1] == '*') { c1++; } map[x1][y1] = ' '; x1++; map[x1][y1] = 'O'; } if (ch == 'w' && map[x1 - 1][y1] != '#') { if (map[x1 - 1][y1] == '*') { c1++; } map[x1][y1] = ' '; x1--; map[x1][y1] = 'O'; } if (ch == 'a' && map[x1][y1 - 1] != '#') { if (map[x1][y1 - 1] == '*') { c1++; } map[x1][y1] = ' '; y1--; map[x1][y1] ='O'; } if (ch == 'd' && map[x1][y1 + 1] != '#') { if (map[x1][y1 + 1] == '*') { c1++; } map[x1][y1] = ' '; y1++; map[x1][y1] = 'O'; } system("cls"); for (int i = 0; i <= 4; i ++) { for (int j = 0; j <= 4; j++) { cout << map[i][j]; } cout << endl; } cout<<"一号玩家吃了"< > sh; if (sh == 'k' && map[x2 + 1][y2] != '#') { if (map[x2 + 1][y2] == '*') { c2++; } map[x2][y2] = ' '; x2++; map[x2][y2] = 'X'; } if (sh == 'i' && map[x2 - 1][y2] != '#') { if (map[x2 - 1][y2] == '*') { c2++; } map[x2][y2] = ' '; x2--; map[x2][y2] = 'X'; } if (sh == 'j' && map[x2][y2 - 1] != '#') { if (map[x2][y2 - 1] == '*') { c2++; } map[x2][y2] = ' '; y2--; map[x2][y2] ='X'; } if (sh == 'l' && map[x2][y2 + 1] != '#') { if (map[x2][y2 + 1] == '*') { c2++; } map[x2][y2] = ' '; y2++; map[x2][y2] = 'X'; } system("cls"); for (int i = 0; i <= 4; i ++) { for (int j = 0; j <= 4; j++) { cout << map[i][j]; } cout << endl; } cout<<"一号玩家吃了"< >b; } if(b==1||j==1) { j++; system("cls"); p("你要玩哪种复杂度的吃豆豆呢?n"); p("1.简单(输入1)2.普通(输入2)3.复杂(输入3)4.坑爹(输入4)n"); int a; cin>>a; if(a==1) { ceasy(); } else if(a==2) { cmiddle(); } else if(a==3) { cdifficult(); } else if(a==4) { ckd(); } else { p("你到底玩不玩啊!!!n"); sleep(1); } } else if(b==2) { p("GOODBYE!下次再来n"); sleep(1); break; } else { p("你到底玩不玩啊!!!"); sleep(1); break; } } } void kd2() { system("cls"); char map[6][6]= { {'*','*','*','*','*','*'}, {'#','*','#','#','#','*'}, {'#','*','*','#','#','*'}, {'#','*','*','#','#','*'}, {'#','z','#','*','*','*'}, {'#','#','#','*','*','O'} }; for (int i = 0; i <= 5; i++) { for (int j = 0; j <= 5; j++) { cout << map[i][j]; } cout << endl; } int x,y; x = 5; y = 5; while (1) { cout << "请输入 w(上) s(下) a(左) d(右),z是终点" << endl; char ch; cin >> ch; if (ch == 's' && map[x + 1][y] != '#') { map[x][y] = ' '; x++; map[x][y] = 'O'; } if (ch == 'w' && map[x - 1][y] != '#') { map[x][y] = ' '; x--; map[x][y] = 'O'; } if (ch == 'a' && map[x][y - 1] != '#') { map[x][y] = ' '; y--; map[x][y] ='O'; } if (ch == 'd' && map[x][y + 1] != '#') { map[x][y] = ' '; y++; map[x][y] = 'O'; } system("cls"); for (int i = 0; i <= 5; i ++) { for (int j = 0; j <= 5; j++) { cout << map[i][j]; } cout << endl; } if (x == 4 && y == 1) { cout << "恭喜你走出了迷宫,坑不坑?你竟然通过了最难关卡,太牛了!"< > ch; if (ch == 's' && map[x + 1][y] != '#') { map[x][y] = ' '; x++; map[x][y] = 'O'; } if (ch == 'w' && map[x - 1][y] != '#') { map[x][y] = ' '; x--; map[x][y] = 'O'; } if (ch == 'a' && map[x][y - 1] != '#') { map[x][y] = ' '; y--; map[x][y] ='O'; } if (ch == 'd' && map[x][y + 1] != '#') { map[x][y] = ' '; y++; map[x][y] = 'O'; } system("cls"); for (int i = 0; i <= 5; i ++) { for (int j = 0; j <= 5; j++) { cout << map[i][j]; } cout << endl; } if (x == 5 && y == 5) { kd2(); break; } if (x == 4 && y == 1) { p("恭喜你走出了迷宫,坑不坑?你竟然通过了最难关卡,太牛了!n"); sleep(3); break; } } } void superdifficult() { system("cls"); char map[20][20]= { {'#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#'}, {'#',' ',' ','O',' ',' ',' ',' ','#','#','#','#','#',' ',' ','#',' ',' ',' ','#'}, {'#',' ','#',' ','#','#',' ','#',' ',' ',' ','%','#',' ','#',' ',' ','#',' ',' '}, {'#',' ','#',' ','#','#',' ',' ',' ','#','#',' ',' ',' ','#',' ','%',' ','#',' '}, {'#',' ','#',' ',' ','#',' ','#',' ',' ','#','#','#',' ',' ','#',' ','#',' ',' '}, {'#',' ','#','#','#','#','#',' ','#',' ','#','#','#','#','#','#',' ','#','#','%'}, {' ',' ','#',' ',' ',' ',' ','%',' ',' ','#','#',' ','#','#','#',' ',' ','#',' '}, {'#',' ','#',' ','#','%','#','#','#','#',' ',' ',' ','#','#',' ','%',' ','#',' '}, {'#',' ','@','#',' ',' ',' ',' ',' ',' ',' ','#','#','#','#','#','#',' ','#','%'}, {'#','@','#',' ','#','#','%','#','#','#','#','#',' ',' ','#',' ','%',' ','#',' '}, {'#','@','#','#','%','#','%','#','#',' ','#','#',' ','#','#','#',' ',' ','#',' '}, {'#',' ',' ','#',' ',' ',' ',' ','#','#','#','#',' ','%',' ',' ',' ','#',' ','%'}, {'#',' ','#',' ','#','#',' ','#',' ',' ',' ','#','%','#','#','#','@',' ','#',' '}, {'#',' ','#',' ','#','#',' ',' ',' ','#','#','#',' ','#','#','#','#','#','%',' '}, {'#',' ','#',' ',' ','#',' ','#',' ',' ','#',' ',' ','%',' ','#','@',' ',' ',' '}, {'#',' ','@','#','#','#','#',' ','#','%',' ',' ','#','#','#','#',' ','#','#','%'}, {' ',' ','#','%',' ',' ',' ','%',' ',' ','#','#',' ',' ',' ','#','%',' ','#',' '}, {'#',' ','#','#','#','#','#','#','#','#',' ',' ','%','#','#','$',' ','#',' ',' '}, {'#','%',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ','#',' ','#',' ','#','#'}, {'#','#','#','#','#','#','#','#','#','#','#','#','#',' ','#',' ',' ',' ',' ','z'}, }; for (int i = 0; i <= 19; i++) { for (int j = 0; j <= 19; j++) { cout << map[i][j]; } cout << endl; } int x,y; x = 1; y = 3; while (1) { cout << "请输入 w(上) s(下) a(左) d(右),z是终点" << endl; char ch; cin >> ch; if (ch == 's' && map[x + 1][y] != '#') { map[x][y] = ' '; x++; map[x][y] = 'O'; } if (ch == 'w' && map[x - 1][y] != '#') { map[x][y] = ' '; x--; map[x][y] = 'O'; } if (ch == 'a' && map[x][y - 1] != '#') { map[x][y] = ' '; y--; map[x][y] ='O'; } if (ch == 'd' && map[x][y + 1] != '#') { map[x][y] = ' '; y++; map[x][y] = 'O'; } system("cls"); for (int i = 0; i <= 19; i ++) { for (int j = 0; j <= 19; j++) { cout << map[i][j]; } cout << endl; } if (x == 19 && y == 19) { p("恭喜你走出了迷宫,你竟然活闯过了超难关卡,牛逼啊,去挑战更难的关卡吧n"); sleep(1); break; } } } void difficult() { system("cls"); char map[10][10]= { {'#','#','#','#','#','#','#','#','#','#'}, {'#',' ',' ','O',' ',' ',' ',' ','#','#'}, {'#',' ','#',' ','#','#',' ','#',' ',' '}, {'#',' ','#',' ','#','#',' ',' ',' ','#'}, {'#',' ','#',' ',' ','#',' ','#',' ',' '}, {'#',' ','#','#','#','#','#',' ','#',' '}, {' ',' ','#',' ',' ',' ',' ',' ',' ',' '}, {'#',' ','#',' ','#',' ','#','#','#','#'}, {'#',' ','@','#',' ',' ',' ',' ',' ',' '}, {'#','#','#','#','#','#','#','#','#','z'}, }; for (int i = 0; i <= 9; i++) { for (int j = 0; j <= 9; j++) { cout << map[i][j]; } cout << endl; } int x,y; x = 1; y = 3; while (1) { cout << "请输入 w(上) s(下) a(左) d(右),z是终点" << endl; char ch; cin >> ch; if (ch == 's' && map[x + 1][y] != '#') { map[x][y] = ' '; x++; map[x][y] = 'O'; } if (ch == 'w' && map[x - 1][y] != '#') { map[x][y] = ' '; x--; map[x][y] = 'O'; } if (ch == 'a' && map[x][y - 1] != '#') { map[x][y] = ' '; y--; map[x][y] ='O'; } if (ch == 'd' && map[x][y + 1] != '#') { map[x][y] = ' '; y++; map[x][y] = 'O'; } system("cls"); for (int i = 0; i <= 9; i ++) { for (int j = 0; j <= 9; j++) { cout << map[i][j]; } cout << endl; } if (x == 9 && y == 9) { p("恭喜你走出了迷宫,你竟然闯过了困难关卡,去挑战更难的关卡吧n"); sleep(1); break; } } } void middle() { system("cls"); char map[8][8]= { {'#','#','#','#','#','#','#','#'}, {'#','#',' ','O',' ',' ','#','#'}, {'#',' ',' ','#','#',' ',' ','#'}, {'#',' ','#',' ','#','#','#','#'}, {'#',' ',' ',' ',' ','#',' ','#'}, {'#','#','#',' ','#','#',' ','#'}, {'#',' ',' ',' ',' ',' ',' ',' '}, {'#','#','#','#','#','#','#','z'}, }; for (int i = 0; i <= 7; i++) { for (int j = 0; j <= 7; j++) { cout << map[i][j]; } cout << endl; } int x,y; x = 1; y = 3; while (1) { cout << "请输入 w(上) s(下) a(左) d(右),z是终点" << endl; char ch; cin >> ch; if (ch == 's' && map[x + 1][y] != '#') { map[x][y] = ' '; x++; map[x][y] = 'O'; } if (ch == 'w' && map[x - 1][y] != '#') { map[x][y] = ' '; x--; map[x][y] = 'O'; } if (ch == 'a' && map[x][y - 1] != '#') { map[x][y] = ' '; y--; map[x][y] ='O'; } if (ch == 'd' && map[x][y + 1] != '#') { map[x][y] = ' '; y++; map[x][y] = 'O'; } system("cls"); for (int i = 0; i <= 7; i ++) { for (int j = 0; j <= 7; j++) { cout << map[i][j]; } cout << endl; } if (x == 7 && y == 7) { p("恭喜你走出了迷宫,普通虽然难了一些,但也不算什么,去挑战更难的关卡吧n"); sleep(1); break; } } } void easy() { system("cls"); char map[5][5]= { {'#','#','#','#','#'}, {'#','O',' ',' ','#'}, {'#',' ','#',' ','#'}, {'#','#',' ',' ',' '}, {'#','#','#','#','z'} }; for (int i = 0; i <= 4; i++) { for (int j = 0; j <= 4; j++) { cout << map[i][j]; } cout << endl; } int x,y; x = 1; y = 1; while (1) { cout << "请输入 w(上) s(下) a(左) d(右),z是终点" << endl; char ch; cin >> ch; if (ch == 's' && map[x + 1][y] != '#') { map[x][y] = ' '; x++; map[x][y] = 'O'; } if (ch == 'w' && map[x - 1][y] != '#') { map[x][y] = ' '; x--; map[x][y] = 'O'; } if (ch == 'a' && map[x][y - 1] != '#') { map[x][y] = ' '; y--; map[x][y] ='O'; } if (ch == 'd' && map[x][y + 1] != '#') { map[x][y] = ' '; y++; map[x][y] = 'O'; } system("cls"); for (int i = 0; i <= 4; i ++) { for (int j = 0; j <= 4; j++) { cout << map[i][j]; } cout << endl; } if (x == 4 && y == 4) { p("恭喜你走出了迷宫,简单不算什么,去挑战更难的关卡吧n"); sleep(1); break; } } } void zmg() { system("cls"); p("走迷宫游戏玩法:找到终点,走到终点(O就是你,#是障碍物,%,@都可以吃掉)n"); while(1) { int b=0; if(j!=1) { system("cls"); p("你还要玩吗?n"); p("1.要(输入1)2.不要(输入2)n"); p("温馨提示:不要太贪玩,因为系统会说输出超长n"); cin>>b; } if(b==1||j==1) { j++; system("cls"); p("你要玩哪种难度的走迷宫呢?n"); p("1.简单(输入1)2.普通(输入2)3.困难(输入3)4.超难(输入4)5.坑爹(输入5)n"); int a; cin>>a; if(a==1) { easy(); } else if(a==2) { middle(); } else if(a==3) { difficult(); } else if(a==4) { superdifficult(); } else if(a==5) { kd(); } else { p("你到底玩不玩啊!!!n"); sleep(1); } } else if(b==2) { p("GOODBYE!下次再来n"); sleep(1); break; } else { p("你到底玩不玩啊!!!n"); sleep(1); break; } } } void pd() { system("cls"); p("你要玩哪种游戏呢?n"); p("1.单人走迷宫(输入1)2.双人吃豆豆(输入2)3.疯狂推箱子(输入3)4.井字棋大战(输入4)n"); int a; cin>>a; if(a==1) { zmg(); } else if(a==2) { cdd(); } else if(a==3) { txz(); } else if(a==4) { jzq(); } else { p("你到底玩不玩啊!n"); sleep(1); } } void ys() { system("cls"); p("首先,我们选一下颜色。n"); p("字体要什么颜色?n"); p("有黑色(输入1),红色(输入2),绿色(输入3),黄色(输入4),蓝色(输入5),紫色(输入6),深绿色(输入7),白色(输入8),跳过(输入9)n"); int a; cin>>a; if(a==1) { cout<<"33[30m"; } else if(a==2) { cout<<"33[31m"; } else if(a==3) { cout<<"33[32m"; } else if(a==4) { cout<<"33[33m"; } else if(a==5) { cout<<"33[34m"; } else if(a==6) { cout<<"33[35m"; } else if(a==7) { cout<<"33[36m"; } else if(a==8) { cout<<"33[37m"; } else if(a==9) { pd(); return; } else { p("滚!没有这个n"); sleep(1); } system("cls"); p("背景要什么颜色?n"); p("有黑色(输入1),红色(输入2),绿色(输入3),黄色(输入4),蓝色(输入5),紫色(输入6),深绿色(输入7),白色(输入8)n"); int g; cin>>g; if(g==1) { cout<<"33[40m"; } else if(g==2) { cout<<"33[41m"; } else if(g==3) { cout<<"33[42m"; } else if(g==4) { cout<<"33[43m"; } else if(g==5) { cout<<"33[44m"; } else if(g==6) { cout<<"33[45m"; } else if(g==7) { cout<<"33[46m"; } else if(g==8) { cout<<"33[47m"; } else { p("滚!没有这个n"); sleep(1); } system("cls"); p("要不要斜体?n"); p("1.要(输入1)2.不要(输入2)n"); int y; cin>>y; if(y==1) { cout<<"33[3m"; } system("cls"); p("要不要下划线?n"); p("1.要(输入1)2.不要(输入2)n"); int o; cin>>o; if(o==1) { cout<<"33[4m"; } system("cls"); pd(); } int main() { p("你要看片头吗?n"); p("1.看(输入1)2.不要(输入2)n"); int q; cin>>q; if(q==2) { ys(); k=1; } if(k==0) { SS; system("cls"); p("MoJang工作室成员:n"); p("群主:林天辰n"); p("副群主:大功臣=>朱品睿n"); p("成员:辛沐宸n"); p("支持者:周子慕 张珈瑞n"); system("cls"); zbc(); SS; cout<<"33[0m"; p("欢迎来到MoJang工作室的小游戏,想不想玩?n"); p("1.想(输入1) 2.不想(输入2)n"); int a; cin>>a; if(a==1) { p("好的,让我们开始play吧n"); ys(); } else { p("强大的我再也不和你这不会欣赏艺术无名小卒玩了!!!!!n"); sleep(3); } } system("cls"); p("玩得这么嗨(有可能你没玩,不要在意),评个分呗n"); p("请输入你给我的分数(满分一百):n"); int c; cin>>c; if(c==0) { p("强大的我再也不和你这不会欣赏艺术无名小卒玩了!!!!!n"); } else if(c>0&&c<=29) { p("呜呜呜······我的游戏真的这么差吗?n"); } else if(c>29&&c<=59) { p("为什么没及格啊?555n"); } else if(c>59&&c<=79) { p("才及格啊?n"); } else if(c>79&&c<=89) { p("达到良了,我会继续努力的n"); } else if(c>89&&c<=99) { p("优秀了啊,太棒了,我会继续努力做出更好的游戏n"); } else if(c==100) { p("满分啊,太棒了,感谢你这么支持我的游戏,我会继续努力做出最棒的游戏n"); } else if(c>100) { p("分数超标啦······(作者激动得晕了)n"); } else { p("你乱评什么?n"); } return 0; }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)