跳到正文

个人记录

My compiler cannot possibly be that cute!

WightyIflia约 20 分钟
原文

这是 2026年9月15日 存档的第 1 版,不是当前版本。查看当前版本

文章信息与版本

文章信息

发布
2026年9月13日
收录
2026年9月15日
更新
2026年11月11日
篇幅
约 20 分钟
获赞
1

版本

  1. v2当前
  2. v1
C++
#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;
};

struct game_variables//游戏内参数
{
    ll ans,cnt,res,rndsum,rndnow;
    ll sumcard;
    vector<ll> idcard;

    ll rate;
};

void moststartinit()//最初初始化
{
    op=0;
}

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();
    */
}

ll 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;
    out=pname;
    slowout(out);
    out=": Build!\n";
    slowout(out);
    //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<=300; ++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;
    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(".....");
    }

    clearscreen();
    cout << "Prologue: My compiler\n";
    for(ll i=1; i<=90; ++i) cout << '-';
    cout << endl;
    cout << "[console]\n";
    cout << "----------" << endl;
    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=10 rndnow=0\nrate=0/5\n\n";
    sleep(100);
    cout << "Functions:\n1.Thinking(cnt-=3 ans++ rndsum++)\n2.Finding(ans-=2 res-- rate++)\n";
    cout << "----------" << endl;
    sleep(500);
}

void go()
{
    if(!op)
    {
        firstgame();
    }

}



signed main()
{
    startscreen();
    go();
}