跳到正文

休闲·娱乐

坚果保龄球 1.2

Zhao_Yinghe约 19 分钟
原文
文章信息与版本

文章信息

发布
2025年8月2日
收录
2026年7月25日
更新
2026年11月17日
篇幅
约 19 分钟

版本

  1. v1当前
C++
#include  <bits/stdc++.h>
#include  <windows.h>
using namespace std; 
int js, tep; 
int a[10][1111]; 
int aaaaa;
void cprint(auto char* s, int color) {
	HANDLE han = GetStdHandle(STD_OUTPUT_HANDLE); 
	SetConsoleTextAttribute(han, FOREGROUND_INTENSITY|color);
	cout << s;
	SetConsoleTextAttribute(han, FOREGROUND_INTENSITY|7);
}
void col(int color) {
	HANDLE han = GetStdHandle(STD_OUTPUT_HANDLE); 
	SetConsoleTextAttribute(han, FOREGROUND_INTENSITY|color);
}
void game1(){
    for(int i = 1; i <= 5; i ++){
        for(int j = 10; j <= 1010; j ++){
            a[i][j] = (rand() % 2) * (rand() % (7 - aaaaa + (aaaaa == 3))); 
            js += a[i][j]; 
        }
    }
	int c; 
    double xh = 1; 
    while(js){
	    tep ++; 
	    if(rand() % 5 == 0){
			Sleep(100); 
    		system("cls"); 
		    cout << "TEP:" << tep; 
			cprint(" Fire Nut\n", 4); 
			for(int i = 1; i <= 5; i ++){
				cout << i << " |"; 
			    for(int j = xh; j < xh + 10; j ++){
				    if(a[i][j]){
				    	cout << a[i][j] << ' '; 
					}else{
						cout << "  "; 
					}
			    }
				cout << '\n' << '\n'; 
			}
			cin >> c; 
	    	int x = c, y = xh - 1, f = 2; 
		    while(y <= 10 + xh + 1){
			    Sleep(100); 
	    		system("cls"); 
		    	cout << "TEP:" << tep; 
				cprint(" Fire Nut\n", 4); 
			    for(int i = 1; i <= 5; i ++){
			    	if(a[i][int(xh) - 1]){
			    		system("cls"); 
			    		cout << "GAME OVER\n" << "TEP:" << tep; 
			    		return ; 
					}
	    		}
			    for(int i = 1; i <= 5; i ++){
					cout << i << " |"; 
			        for(int j = xh; j < xh + 10; j ++){
			        	if(i-x || j-y){
			        		if(a[i][j]){
			        			cout << a[i][j] << ' '; 
							}else{
								cout << "  "; 
							}
						}else{
							cprint("#", 4); 
							cout << ' ';  
						}
			        }
			    	cout << '\n' << '\n'; 
	    		}
	    		y ++; 
		    	xh += 0.1; 
		    	if(a[x][y]){
		    		js -= a[x + 1][y] + a[x + 1][y-1] + a[x + 1][y + 1] + a[x][y + 1] + a[x][y-1] + a[x][y] + a[x-1][y] + a[x-1][y-1] + a[x-1][y + 1]; 
		    		a[x + 1][y] = 0; a[x + 1][y-1] = 0; a[x + 1][y + 1] = 0; a[x][y + 1] = 0; a[x][y-1] = 0; a[x][y] = 0; a[x-1][y] = 0; a[x-1][y-1] = 0; a[x-1][y + 1] = 0; 
				    Sleep(100); 
		    		system("cls"); 
			    	cout << "TEP:" << tep; 
					cprint(" Fire Nut\n", 4); 
				    for(int i = 1; i <= 5; i ++){
				    	if(a[i][int(xh)-1]){
				    		system("cls"); 
			    			cout << "GAME OVER\n" << "TEP:" << tep; 
				    		return ; 
						}
		    		}
				    for(int i = 1; i <= 5; i ++){
						cout << i << " |"; 
				        for(int j = xh; j < xh + 10; j ++){
				        	if(i-x || j-y){
				        		if(a[i][j]){
				        			cout << a[i][j] << ' '; 
								}else{
									cout << "  "; 
								}
							}else{
								cprint("#", 4); 
								cout << ' ';  
							}
				        }
				    	cout << '\n' << '\n'; 
		    		}
		    		break; 
				}
			}
		}else if(rand() % 4 == 0){
			Sleep(100); 
	    	system("cls"); 
		    cout << "TEP:" << tep; 
			cprint(" Big Nut\n", 0); 
			for(int i = 1; i <= 5; i ++){
				cout << i << " |"; 
			    for(int j = xh; j < xh + 10; j ++){
				    if(a[i][j]){
				        cout << a[i][j] << ' '; 
					}else{
						cout << "  "; 
					}
			    }
				cout << '\n' << '\n'; 
			}
			cin >> c;
	    	int x = c, y = xh - 1, f = 2; 
			while(y <= 10 + xh + 1){
			    Sleep(100); 
	    		system("cls"); 
		    	cout << "TEP:" << tep; 
				cprint(" Big Big Nut\n", 0); 
			    for(int i = 1; i <= 5; i ++){
			    	if(a[i][int(xh)-1]){
			    		system("cls"); 
			    		cout << "GAME OVER\n" << "TEP:" << tep; 
			    		return ; 
					}
	    		}
			    for(int i = 1; i <= 5; i ++){
					cout << i << " |"; 
			        for(int j = xh; j < xh + 10; j ++){
				        if(i - x || j-y){
				        	if(a[i][j]){
				        		cout << a[i][j] << ' '; 
							}else{
								cout << "  "; 
							}
						}else{
							cprint("#", 0); 
							cout << ' ';  
						}
			        }
			    	cout << '\n' << '\n'; 
	    		}
		    	y ++; 
		    	if(f == 1) x --; 
		    	if(f == 0) x ++; 
		    	xh += 0.1; 
		    	if(a[x][y]){
					js -= a[x][y]; 
		    		a[x][y] = 0; 
					if(f != 2 || x != 5) f = !f; 
					else if(f == 2) f --; 
				}else if((x == 1 || x == 5) && f < 2){
					f = !f; 
				}
			}
		}else if(rand() % 4 == 0){
			Sleep(100); 
	    	system("cls"); 
		    cout << "TEP:" << tep; 
			cprint(" Big Big Nut\n", 0); 
			for(int i = 1; i <= 5; i ++){
				cout << i << " |"; 
			    for(int j = xh; j < xh + 10; j ++){
				    if(a[i][j]){
				        cout << a[i][j] << ' '; 
					}else{
						cout << "  "; 
					}
			    }
				cout << '\n' << '\n'; 
			}
			cin >> c; 
	    	int x = c, y = xh - 1, f = 2; 
			while(y <= 10 + xh + 1){
			    Sleep(100); 
	    		system("cls"); 
		    	cout << "TEP:" << tep; 
				cprint(" Big Big Nut\n", 0); 
			    for(int i = 1; i <= 5; i ++){
			    	if(a[i][int(xh)-1]){
			    		system("cls"); 
			    		cout << "GAME OVER\n" << "TEP:" << tep; 
			    		return ; 
					}
	    		}
			    for(int i = 1; i <= 5; i ++){
					cout << i << " |"; 
			        for(int j = xh; j < xh + 10; j ++){
				        if(i - x || j - y){
				        	if(a[i][j]){
				        		cout << a[i][j] << ' '; 
							}else{
								cout << "  "; 
							}
						}else{
							cprint("#", 0); 
							cout << ' ';  
						}
			        }
			    	cout << '\n' << '\n'; 
	    		}
		    	y ++; 
		    	if(f == 1) x --; 
		    	if(f == 0) x ++; 
		    	xh += 0.1; 
		    	if(a[x][y]){
					js -= a[x][y]; 
		    		a[x][y] = 0; 
					js -= a[x - 1][y]; 
			    	a[x - 1][y] = 0; 
					js -= a[x - 1][y - 1]; 
			    	a[x - 1][y - 1] = 0; 
					js -= a[x - 1][y + 1]; 
			    	a[x - 1][y + 1] = 0; 
					js -= a[x][y - 1]; 
			    	a[x][y - 1] = 0; 
					js -= a[x][y + 1]; 
			    	a[x][y + 1] = 0; 
					js -= a[x + 1][y]; 
			    	a[x + 1][y] = 0; 
					js -= a[x + 1][y - 1]; 
			    	a[x + 1][y - 1] = 0; 
					js -= a[x + 1][y + 1]; 
			    	a[x + 1][y + 1] = 0; 
					if(f != 2 || x != 5) f = !f; 
					else if(f == 2) f --; 
				}else if((x == 1 || x == 5) && f < 2){
					f = !f; 
				}
			}
		}else if(rand() % 4 == 0){
			Sleep(100); 
	    	system("cls"); 
		    cout << "TEP:" << tep; 
			cprint(" Super Nut\n", 3); 
			for(int i = 1; i <= 5; i ++){
				cout << i << " |"; 
			    for(int j = xh; j < xh + 10; j ++){
				    if(a[i][j]){
				        cout << a[i][j] << ' '; 
					}else{
						cout << "  "; 
					}
			    }
				cout << '\n' << '\n'; 
			}
			cin >> c; 
	    	int x = c, y = xh - 1; 
			while(y <= 10 + xh + 1){
			    Sleep(100); 
	    		system("cls"); 
		    	cout << "TEP:" << tep; 
				cprint(" Super Nut\n", 3); 
			    for(int i = 1; i <= 5; i ++){
			    	if(a[i][int(xh)-1]){
			    		system("cls"); 
			    		cout << "GAME OVER\n" << "TEP:" << tep; 
			    		return ; 
					}
	    		}
			    for(int i = 1; i <= 5; i ++){
					cout << i << " |"; 
			        for(int j = xh; j < xh + 10; j ++){
				        if(i - x || j - y){
				        	if(a[i][j]){
				        		cout << a[i][j] << ' '; 
							}else{
								cout << "  "; 
							}
						}else{
							cprint("#", 3); 
							cout << ' ';  
						}
			        }
			    	cout << '\n' << '\n'; 
	    		}
		    	y ++; 
		    	xh += 0.1; 
				js -= a[x][y]; 
		    	a[x][y] = 0; 
				js -= a[x - 1][y]; 
		    	a[x - 1][y] = 0; 
				js -= a[x - 1][y - 1]; 
		    	a[x - 1][y - 1] = 0; 
				js -= a[x - 1][y + 1]; 
		    	a[x - 1][y + 1] = 0; 
				js -= a[x][y - 1]; 
		    	a[x][y - 1] = 0; 
				js -= a[x][y + 1]; 
		    	a[x][y + 1] = 0; 
				js -= a[x + 1][y]; 
		    	a[x + 1][y] = 0; 
				js -= a[x + 1][y - 1]; 
		    	a[x + 1][y - 1] = 0; 
				js -= a[x + 1][y + 1]; 
		    	a[x + 1][y + 1] = 0; 
			}
		}else{
			Sleep(100); 
	    	system("cls"); 
		    cout << "TEP:" << tep; 
			cprint(" Ordinary Nut\n", 6); 
			for(int i = 1; i <= 5; i ++){
				cout << i << " |"; 
			    for(int j = xh; j < xh + 10; j ++){
				    if(a[i][j]){
				        cout << a[i][j] << ' '; 
					}else{
						cout << "  "; 
					}
			    }
				cout << '\n' << '\n'; 
			}
			cin >> c; 
	    	int x = c, y = xh - 1, f = 2; 
			while(y <= 10 + xh + 1){
			    Sleep(100); 
	    		system("cls"); 
		    	cout << "TEP:" << tep; 
				cprint(" Ordinary Nut\n", 6); 
			    for(int i = 1; i <= 5; i ++){
			    	if(a[i][int(xh)-1]){
			    		system("cls"); 
			    		cout << "GAME OVER\n" << "TEP:" << tep; 
			    		return ; 
					}
	    		}
			    for(int i = 1; i <= 5; i ++){
					cout << i << " |"; 
			        for(int j = xh; j < xh + 10; j ++){
				        if(i - x || j - y){
				        	if(a[i][j]){
				        		cout << a[i][j] << ' '; 
							}else{
								cout << "  "; 
							}
						}else{
							cprint("#", 6); 
							cout << ' ';  
						}
			        }
			    	cout << '\n' << '\n'; 
	    		}
		    	y ++; 
		    	if(f == 1) x --; 
		    	if(f == 0) x ++; 
		    	xh += 0.1; 
		    	if(a[x][y]){
		    		a[x][y] --; 
					if(f != 2 || x != 5) f = !f; 
					else if(f == 2) f --; 
					js --; 
				}else if((x == 1 || x == 5) && f < 2){
					f = !f; 
				}
			}
		}
	}
    system("cls");  
    if(aaaaa == 3) cprint(" 下一波即将来袭!\n", 4), col(4), system("pause"), col(7), game1();
    cout << "YOU ARE THE NUT BOWLING HERO!\n";
}
int main(void){
    srand(time(0));
    system("cls");
    cout << "1.困难\n2.简单\n3.无尽\n";
    cin >> aaaaa;
    game1();
    main();
    return 0; 
}
原文