#include <bits/stdc++.h>
#include <windows.h>
#define GREEN_ SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN);
#define RED_ SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED);
#define BLUE_ SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_BLUE);
#define F SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7);
using namespace std;
int rd(int a,int b){
srand((unsigned)time(NULL));
return (rand()%(b-a+1+a));
}
int main(){
srand((int)time(0));
F
srand((unsigned)time(NULL));
int w_list[10]={2,4,15,15,16,16,25,7,5};
string names[10]={"宇宙超级凶","大凶","小凶","小平","中平","小吉","中吉","大吉","宇宙超级吉"};
string good_list[100][100]={
{"诸事不宜","诸事不宜","诸事不宜","诸事不宜"},
{"宜:装弱","宜:窝在家里","宜:刷题","宜:吃饭"},
{"宜:刷题","宜:开电脑","宜:写作业","宜:睡觉"},
{"宜:发朋友圈","宜:出去玩","宜:打游戏","宜:吃饭"},
{"宜:学习","宜:研究Ruby","宜:研究cf","宜:玩游戏"},
{"宜:膜拜大神","宜:扶老奶奶过马路","宜:玩网游","宜:喝可乐"},
{"宜:吃东西","宜:打sdvx","宜:打开洛谷","宜:出行"},
{"宜:玩网游","宜:抢最优解","宜:写作业","宜:考试"},
{"宜:谈恋爱","宜:看电影","宜:买彩票","宜:购物"},
} ;
string good_shi_list[100][100]={
{"","","",""},
{"谦虚最好了","不出门没有危险","直接AC","吃的饱饱的再学习"},
{"一次AC","发现电脑死机了","全对","睡足了再学习"},
{"点赞量破百","真开心","十连胜","吃饱了"},
{"都会","有了新发现","发现新大陆","直接胜利"},
{"接受神之沐浴","增加RP","犹如神助","真好喝"},
{"吃饱了","今天状态好","发现AC的题变多了","路途顺畅"},
{"犹如神助","一发就是最优解","全是会的题","考的全会,蒙的全对"},
{"可以成功","想看的电影刚刚上映","能中一等奖","全部打折"},
} ;
string bad_list[100][100]={
{"忌:出门","忌:睡觉","忌:运动","忌:在家呆着"},
{"忌:打sdvx","忌:出行","忌:玩手机","忌:吃方便面"},
{"忌:关电脑","忌:开挂","忌:纳财","忌:考试"},
{"忌:膜拜大神","忌:评论","忌:研究Java","忌:吃方便面"},
{"忌:发朋友圈","忌:打开洛谷","忌:研究c++","忌:出行"},
{"忌:探险","忌:发视频","忌:发博客","忌:给别人点赞"},
{"忌:写程序","忌:使用unity打包exe","忌:装弱","忌:打开CSDN"},
{"忌:打cs","忌:看视频","忌:吃米饭","忌:逞强"},
{"万事皆宜","万事皆宜","万事皆宜","万事皆宜"},
} ;
string bad_shi_list[100][100]={
{"一出门就出车祸","一睡就起不来了","一动就骨折","天花板会掉下来"},
{"今天状态不好","路途也许坎坷","好家伙直接死机","没有调料包"},
{"死机了","被制裁","你没有财运","没及格"},
{"被人嘲笑","被喷","心态崩溃","只有一包调味料"},
{"被人当成买面膜的","大凶","五行代码114514个报错","路途坎坷"},
{"你失踪了","被人喷","阅读量1.14514个","被人嘲笑"},
{"报错114514+","电脑卡死,刚做的PPT全没了","被人看穿","你的只因没了(doge)"},
{"全是猪队友","会被发现","会被呛到","会被揭穿"},
{"","","",""},
} ;
int w_sum=0;
int length=sizeof(w_list)/sizeof(int);
for(int i=0;i<length;i++){
w_sum+=w_list[i];
}
int randval=rand()%w_sum;
int rward;
for(int i=0;i<length;i++){
if(randval<=w_list[i]){
rward=i;
break;
}
randval-=w_list[i];
}
printf("你的运势是:\n");
//rward=0;
//cout<<names[rward].c_str()<<endl;
cout<<" ";
if(rward==0)
{
BLUE_
printf("§ 宇宙超级凶 §\n");
F
}
if(rward==1)
{
BLUE_
printf("§ 大凶 §\n");
F
}
if(rward==2)
{
BLUE_
printf("§ 小凶 §\n");
F
}
if(rward==3)
{
GREEN_
printf("§ 小平 §\n");
F
}
if(rward==4)
{
GREEN_
printf("§ 中平 §\n");
F
}
if(rward==5)
{
RED_
printf("§ 小吉 §\n");
F
}
if(rward==6)
{
RED_
printf("§ 中吉 §\n");
F
}
if(rward==7)
{
RED_
printf("§ 大吉 §\n");
F
}
if(rward==8)
{
RED_
printf("§ 宇宙超级吉 §\n");
F
}
cout<<endl;
RED_
cout<<good_list[rward][rd(0,3)]<<endl;
cout<<" "<<good_shi_list[rward][rd(0,3)]<<endl;
BLUE_
srand((int)time(0));
cout<<bad_list[rward][rd(0,3)]<<" "<<endl;
cout<<" "<<bad_shi_list[rward][rd(0,3)]<<" "<<endl;
F
return 0;
}
2023.7.17-17:00更新:添加更多运势
2023.7.17-17:10更新:凶的运势改为蓝色,解决一些BUG
2023.7.18-8:31更新:修改代码BUG