My compiler cannot possibly be that cute!
WightyIflia · · 休闲·娱乐
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
//输出和等待
#include<thread>
#include<chrono>
void quickout(string s)
{
for(char i:s)
{
cout << i;
this_thread::sleep_for(chrono::milliseconds(10));
}
}
void slowout(string s)
{
for(char i:s)
{
cout << i;
this_thread::sleep_for(chrono::milliseconds(100));
}
}
void sleep(ll s)
{
this_thread::sleep_for(chrono::milliseconds(s));
}
//随机数
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
//清屏
#include <cstdlib>
void clearscreen()
{
#ifdef _WIN32
system("cls");
#else
system("clear");
#endif
}
/*
FILE *fp = fopen("save.txt", "r");
if (fp != NULL)
{
fscanf(fp, "%d", &ans);
fclose(fp);
printf("读档成功,上次 ans = %d\n", ans);
}
else
{
printf("没有存档,从 0 开始\n");
}
*/
ll op;//起始参数
string pname;//玩家的名字
struct game_setting
{
ll level;
};
game_setting playerset;
struct game_variables//游戏内参数
{
ll ans,cnt,res,rndsum,rndnow;
ll sumcard;
vector<ll> idcard;
ll rate;
};
struct level_settings
{
string name;
ll id;
};
vector<level_settings> levels;
ll levelsum;
void moststartinit()//最初初始化
{
op=0;
playerset.level=1;
// !!!
levelsum=1;
levels.push_back({"Start",1});
}
void startscreen()
{
clearscreen();
op=0;
for(ll i=1; i<=25; ++i) cout << ' ';
cout << "My compiler cannot possibly be that cute!" << endl;
for(ll i=1; i<=90; ++i) cout << '-';
cout << endl;
cout << "If you are a beginner, say \"new\" to clear unnecessary data.";
cout << endl;
cout << "Say \"start\" for a new game.";
cout << endl;
cout << "Say \"continue\" to continue your game.";
cout << endl;
cout << endl << "> ";
string s;
while(1)
{
getline(cin,s);
if(s.find("continue")!=string::npos)
{
op=2;
return ;
}
else if(s.find("new")!=string::npos)
{
moststartinit();
break;
}
else if(s.find("start")!=string::npos)
{
moststartinit();
op=1;
break;
}
clearscreen();
op=0;
for(ll i=1; i<=25; ++i) cout << ' ';
cout << "My compiler cannot possibly be that cute!" << endl;
for(ll i=1; i<=90; ++i) cout << '-';
cout << endl;
cout << "If you are a beginner, say \"new\" to clear unnecessary data.";
cout << endl;
cout << "Say \"start\" for a new game.";
cout << endl;
cout << "Say \"continue\" to continue your game.";
cout << endl;
cout << endl << "> ";
}
cout << endl << endl;
quickout("Your name?");
cout << endl << endl;
cout << ": ";
getline(cin,s);
pname=s;
cout << endl << endl;
slowout("OK! ");
quickout(pname);
slowout(", let us go--");
sleep(500);
return ;
}
void output_help()//输出教程
{
cout << '-';
cout << "input any keys to close help.";
cout << endl;
string s;
getline(cin,s);
clearscreen();
return ;
/*
if(s.find("help")!=string::npos)
output_help();
*/
}
void firstgame()
{
//前置剧情1
clearscreen();
slowout("......");
clearscreen();
cout << "Prologue: My compiler\n";
for(ll i=1; i<=90; ++i) cout << '-';
cout << endl;
string out;
out="N: You are a coder.\n";
slowout(out);
out="N: As usual, you're about to start coding.\n";
slowout(out);
out=" (You can put anything as code)\n";
slowout(out);
out=" (but every code need a '}' to over)\n\n";
slowout(out);
sleep(3000);
//编辑代码
clearscreen();
cout << "Prologue: My compiler\n";
for(ll i=1; i<=90; ++i) cout << '-';
cout << endl;
cout << "[Yistie code compiler - 1.0.0]\n";//伊丝玓
cout << " Build Run Rebuild";
cout << "\n\n";
cout << " [main.cpp]\n----------\n";
string s="";
while(1)
{
getline(cin,s);
if(s.find('}')!=string::npos) break;
}
cout << "----------" << endl;
sleep(1000);
//控制台输入
clearscreen();
cout << "Prologue: My compiler\n";
for(ll i=1; i<=90; ++i) cout << '-';
cout << endl;
out="N: After editing the code, you opened the console.\n";
slowout(out);
out=pname;
slowout(out);
out=": Build and run my code...\n";
slowout(out);
sleep(1000);
clearscreen();
cout << "Prologue: My compiler\n";
for(ll i=1; i<=90; ++i) cout << '-';
cout << endl;
cout << "[console]\n";
cout << "----------" << endl;
out="g++ main.cpp -o myfruit.exe\n";
slowout(out);
cout << "----------" << endl;
sleep(1000);
clearscreen();
cout << "Prologue: My compiler\n";
for(ll i=1; i<=90; ++i) cout << '-';
cout << endl;
out=pname;
slowout(out);
out=": Build!\n";
slowout(out);
sleep(500);
//CE
clearscreen();
cout << "Prologue: My compiler\n";
for(ll i=1; i<=90; ++i) cout << '-';
cout << endl;
for(ll i=1; i<=3; ++i)
{
slowout("......");
clearscreen();
cout << "Prologue: My compiler\n";
for(ll i=1; i<=90; ++i) cout << '-';
cout << endl;
}
cout << "\033[31m";
string erroring="Error ";
string crash="Crash ";
string failed="Failed ";
for(ll i=1; i<=500; ++i)
{
for(ll j=1; j<=15; ++j)
{
ll op1=rnd()%3;
if(op1==0) cout << erroring;
if(op1==1) cout << crash;
if(op1==2) cout << failed;
}
cout << endl;
}
cout <<"\033[0m";
for(ll i=1; i<=90; ++i) cout << '-';
cout << endl;
sleep(3000);
//自白
clearscreen();
cout << "Prologue: My compiler\n";
for(ll i=1; i<=90; ++i) cout << '-';
cout << endl;
out=pname;
slowout(out);
out=": CE......\n";
slowout(out);
out=pname;
slowout(out);
out=": Why?\n";
slowout(out);
sleep(3000);
//出场
clearscreen();
cout << "Prologue: My compiler\n";
for(ll i=1; i<=90; ++i) cout << '-';
cout << endl;
cout << "[console]\n";
cout << "----------" << endl;
out="......_.Vso$kd#mM>es_0)1|d;acl###$%%%---------\n";
slowout(out);
cout << "----------" << endl;
sleep(500);
clearscreen();
cout << "Prologue: My compiler\n";
for(ll i=1; i<=90; ++i) cout << '-';
cout << endl;
cout << "[console]\n";
cout << "----------" << endl;
out="\"Hi!\"\n";
slowout(out);
out="\"I'm Yistie, also your compiler\"\n";
slowout(out);
out="\"So, because I... uh... accidentally lost your libraries, they're now scattered all over the place.\"\n";
//翻译:由于我...额...一不小心搞丢了你的库,导致它们散到了各种地方。
slowout(out);
out="\"Sorry......\"\n";
slowout(out);
cout << "----------" << endl;
sleep(2000);
//主人公无语……
clearscreen();
cout << "Prologue: My compiler\n";
for(ll i=1; i<=90; ++i) cout << '-';
cout << endl;
out=pname;
slowout(out);
out=": ......\n";
slowout(out);
sleep(500);
out=pname;
slowout(out);
out=": Good... very good. ";
slowout(out);
out="(laughing sinisterly)\n";//阴森的笑着
slowout(out);
sleep(1000);
//编译器求饶
clearscreen();
cout << "Prologue: My compiler\n";
for(ll i=1; i<=90; ++i) cout << '-';
cout << endl;
cout << "[console]\n";
cout << "----------" << endl;
out="QwQ\n";
slowout(out);
cout << "----------" << endl;
sleep(1000);
clearscreen();
cout << "Prologue: My compiler\n";
for(ll i=1; i<=90; ++i) cout << '-';
cout << endl;
cout << "[console]\n";
cout << "----------" << endl;
out="\"Wai.....Wait! Please don't delete me!\"\n";
slowout(out);
out="\"I can find the libraries with you!\"\n";
slowout(out);
cout << "----------" << endl;
sleep(1000);
//主人公放下
clearscreen();
cout << "Prologue: My compiler\n";
for(ll i=1; i<=90; ++i) cout << '-';
cout << endl;
out=pname;
slowout(out);
out=": Hehe...\n";
slowout(out);
sleep(500);
out=" (You take cancel of \"Delete the \'Yistie code compiler\'\")\n";
slowout(out);
sleep(1000);
out=pname;
slowout(out);
out=": What should I do?\n";
slowout(out);
sleep(2000);
//QwQ
//介绍规则(终于!!!)
clearscreen();
cout << "Prologue: My compiler\n";
for(ll i=1; i<=90; ++i) cout << '-';
cout << endl;
cout << "[console]\n";
cout << "----------" << endl;
out="\"Even though all the libraries are gone, I found three weird variables and a function still hanging around.\"\n";
slowout(out);
out="\"Ans, cnt, res and rnd\"\n";
slowout(out);
cout << "----------" << endl;
sleep(1000);
//AwA
clearscreen();
cout << "Prologue: My compiler\n";
for(ll i=1; i<=90; ++i) cout << '-';
cout << endl;
out=pname;
slowout(out);
out=": Three basic weird variables and \'random number generator\'\n";
slowout(out);
sleep(1000);
//继续
clearscreen();
cout << "Prologue: My compiler\n";
for(ll i=1; i<=90; ++i) cout << '-';
cout << endl;
cout << "[console]\n";
cout << "----------" << endl;
cout << "Round 1/5\n";
out="\"And some special controls hidden all over the place.\"\n";
//以及一些特殊操作方式隐藏在各种地方
slowout(out);
out="\"I can find some of them for a round... Wait me...\"\n";
slowout(out);
cout << "----------" << endl;
sleep(500);
//终于正片开始
for(ll i=1; i<=3; ++i)
{
clearscreen();
cout << "Prologue: My compiler\n";
for(ll i=1; i<=90; ++i) cout << '-';
cout << endl;
slowout(".....");
}
//示范1
clearscreen();
cout << "Prologue: My compiler\n";
for(ll i=1; i<=90; ++i) cout << '-';
cout << endl;
cout << "[console]\n";
cout << "----------" << endl;
cout << "Round 1/5\n";
out="\"I find the libraries of \'output\', you can see them.\"\n\n";
slowout(out);
sleep(1000);
cout << "ans=0 cnt=3 res=1 rndsum=9 rndnow=0\nrate=0/5\n\n";
sleep(100);
cout << "Functions:\n1.Thinking(cnt-=3 ans++ rndsum++)\n2.Finding(ans-=2 res-- rate+=3)\n";
sleep(3000);
out="\"En... You can say the id of functions to do it when your weird variables are enough\"\n";
slowout(out);
out="\"When the rates over my points, the libraries in this place are collection completely.\"\n";
slowout(out);
out="\"For example......\"\n\n";
slowout(out);
out="Take 1\nEnd\n";
quickout(out);
cout << "----------" << endl;
sleep(3000);
//示范2
clearscreen();
cout << "Prologue: My compiler\n";
for(ll i=1; i<=90; ++i) cout << '-';
cout << endl;
cout << "[console]\n";
cout << "----------" << endl;
cout << "Round 2/5\n";
cout << "ans=1 cnt=0 res=1 rndsum=10 rndnow=0\nrate=0/5\n\n";
sleep(100);
cout << "Functions:\n1.Finding(ans-=2 res-- rate+=3)\n2.Fortune(rndsum-=k,rndnow+=k)\n";
sleep(2000);
out="\n^_^\n\"We can take rndsum to take rnd().\"\n\"Each point of rndsum used increases the crit rate by 10%. Triggering a crit doubles the crit rate increase.\"\n";
//每使用rndsum一点就可以增加10%暴击率。触发暴击rate增加翻倍
slowout(out);
out="Take 2 10\n";
quickout(out);
cout << "----------" << endl;
sleep(3000);
clearscreen();
cout << "Prologue: My compiler\n";
for(ll i=1; i<=90; ++i) cout << '-';
cout << endl;
cout << "[console]\n";
cout << "----------" << endl;
cout << "Round 2/5\n";
cout << "ans=1 cnt=0 res=1 rndsum=0 rndnow=10\nrate=0/5\n\n";
sleep(100);
cout << "Functions:\n1.Finding(ans-=2 res-- rate+=3)\n";
sleep(2000);
out="Take 1\nEnd\n";
quickout(out);
cout << "----------" << endl;
sleep(3000);
//示例3
clearscreen();
cout << "Prologue: My compiler\n";
for(ll i=1; i<=90; ++i) cout << '-';
cout << endl;
cout << "[console]\n";
cout << "----------" << endl;
cout << "Round 3/5\n";
cout << "ans=1 cnt=0 res=1 rndsum=0 rndnow=0(rnd=0<10 k*=2)\nrate=6/5\n\n";
sleep(100);
cout << "Functions:\n";
sleep(2000);
out="En... collecting completely! Next!\n";
slowout(out);
sleep(1000);
cout << "----------" << endl;
sleep(3000);
}
//最主要的游戏主程序
void playgame(ll LEVEL)
{
}
ll nowlevels;
void takelevel()
{
clearscreen();
nowlevels=-1;
for(auto i:levels)
{
cout << i.id << '.' << i.name << endl;
}
cout << endl << "> ";
string morw;
ll p_in=0;
getline(cin,morw);
if(morw.find("return")!=string::npos) exit(0);
for(auto i:morw)
{
if(isdigit((unsigned char)i)) p_in=p_in*10+(i-'0');
}
if(p_in<=playerset.level && p_in>0)
{
nowlevels=p_in;
}
}
void go()
{
if(!op)
{
firstgame();
}
while(1)
{
takelevel();
if(nowlevels!=-1)
{
playgame(nowlevels);
}
}
}
signed main()
{
startscreen();
go();
}