隨機組句小遊戲-V1.13版本

LM_YU_hxq發表於2024-10-05

玩法:隨機抽取地點人物事件,來組句

2024/10/03 進行微調.

\(程式碼/Code:\)

#include<bits/stdc++.h>
#include<windows.h>
#define SM_ printf("%c%c%c%c%c%c",-64,-18,-278,-59,-319,-40);
using namespace std;
int s1,s2,s3,xz1,bool01;
string copy_;
string place[105]= {"在學校裡","在餐廳裡","在廁所裡","在家裡","在上課時","在成年公寓裡","在小樹林裡","在臭水溝裡","在上廁所時","在床上","在女生宿舍裡","在女廁裡","在講臺上","在糞坑裡","在打遊戲時","在晚上時","在打架時"};
string with[105]= {"和老師一起","和孫海洋一起","和媽媽一起","抱著空調","和一個男生一起","和物件一起","抱著姐姐","和華子睿一起","與李佳俊一起","叼著鞋子","和東施","與一個女生一起","和肖明洋一起","和小蜜蜂一起","和孟祥帥一起","和吳俊宇一起","騎著孫海洋"};
string done[105]= {"吃屎","同床共枕","啃腳丫","流口水","親吻","像狗一樣死去","陰暗的爬行","跳鋼管舞","遨遊太空","扣鼻屎","暢談人生","一起吃大餐","洗澡","蘭花指並說哥哥來啦?","滾來滾去","肘擊勞大","用腳洗臉","親密"};
void Slowsay(string s) {
	for (int i = 0; s[i]; i++) {
		cout << s[i];
		int ttt;
		for (int i = 1; i <= 1000000; i++)ttt++;
	}
}
void Copy(string TempBin) { //複製至剪下板
	HGLOBAL hMemBin = NULL;
	PCHAR   LockBin = NULL;
	OpenClipboard(NULL);
	EmptyClipboard();
	hMemBin = GlobalAlloc(GMEM_MOVEABLE, TempBin.size() + 1);
	LockBin = (PCHAR)GlobalLock(hMemBin);
	RtlMoveMemory(LockBin, TempBin.c_str(), TempBin.size() + 1);
	GlobalUnlock(hMemBin);
	LockBin = NULL;
	SetClipboardData(CF_TEXT, hMemBin);
	CloseClipboard();
}
void Color(int a) { //改變單字顏色 (白藍綠紫紅靛黃)
	if(a==0) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
	if(a==1) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
	if(a==2) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
	if(a==3) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
	if(a==4) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
	if(a==5) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
	if(a==6) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
}
void swap_pwd()
{
	srand((unsigned)time(NULL));
	swap(place[0],place[1]);swap(place[2],place[3]);swap(place[4],place[5]);swap(place[6],place[7]);swap(place[8],place[9]);swap(place[10],place[11]);swap(place[12],place[13]);swap(place[14],place[15]);
	swap(with[0],with[1]);swap(with[2],with[3]);swap(with[4],with[5]);swap(with[6],with[7]);swap(with[8],with[9]);swap(with[10],with[11]);swap(with[12],with[13]);swap(with[14],with[15]);
	swap(done[0],done[1]);swap(done[2],done[3]);swap(done[4],done[5]);swap(done[6],done[7]);swap(done[8],done[9]);swap(done[10],done[11]);swap(done[12],done[13]);swap(done[14],done[15]);
}
int main() {
	while(true) {
		Color(0),Slowsay("請問你自己選擇還是由電腦選擇? (輸入1為自己選||0為電腦選)  ");
		Color(6),cout<<' '<<' '<<' ';SM_;
		cout<<"製作. \n\n";
		cin>>xz1;
		cout<<"\n";
		switch(xz1) {
			case 1: {
				hxq: Color(3),Slowsay("請輸入3個小於等於16且大於等於0的數,每兩個數之間要有一個空格.\n\n");
				Color(1),cin>>s1>>s2>>s3;
				bool01=rand()%2;
				if(bool01) swap_pwd();
				if(s1<0||s2<0||s3<0||s1>17||s2>17||s3>17)
				{
					Color(6),cout<<"輸入似乎有點錯誤,請重新輸入~\n\n"; 
					goto hxq;	
				}
				Color(2),Slowsay("抽選中...\n\n");
				Sleep(1200);
				Color(6),cout<<place[s1]<<with[s2]<<done[s3]<<'\n';
				copy_=place[s1]+with[s2]+done[s3];
				Copy(copy_);
				Color(4),Slowsay("\n內容已複製.\n\n");
				Color(1),system("pause\n\n");
				break;
			}
			case 0: {
				srand((unsigned)time(NULL));
				s1=rand()%17-1;
				s2=rand()%17-1;
				s3=rand()%17;
				bool01=rand()%2;
				if(bool01) swap_pwd();
				Color(2),Slowsay("抽選中...\n\n");
				Sleep(1200);
				Color(6),cout<<place[s1]<<with[s2]<<done[s3]<<'\n';
				copy_=place[s1]+with[s2]+done[s3];
				Copy(copy_);
				Color(4),Slowsay("\n內容已複製.\n\n");
				Color(1),system("pause\n\n");
				break;
			}
			default:{
				Color(3),Slowsay("輸入錯誤,請重新輸入~\n\n");
				break;
			}
		}
	}
	return 0;
}

相關文章