自己写的屑游戏

· · 个人记录

水平垃圾。摸鱼时写的。

不定期更新。

模仿一个不太火的网络游戏,有人找找吗?

//原作:https://icelava.top/SudoerOfMyself/ 
//原作github:https: //github.com/ForkKILLET/SudoerOfMyself.git 
//原作者: ForkΨKILLET
//c++ 版本由Hughpig原创 
#include<string>
#include<fstream>
#include<iostream>
#include<Windows.h>
#define il inline
#define ll long long
using namespace std;

ll gamenow=-1;string input;

il void output(string s);
il void readin();
il void save();
il ll read();
il void write(ll x);
il void say(string a);
il void fastsay(string a);

int main()
{
    readin();
    if(gamenow>2)
    {
        gamenow=2;
    }
    SetConsoleTitle("SudoerOfMyself");
    if(gamenow==-1){
        printf("SudoerOfMyself updated: \n");
        printf("at https://github.com/ForkKILLET/SudoerOfMyself.git \n");
        printf("v0.1.1 by Hughpig, on 2022/8/17 18:38:42 \n");
        gamenow=0;
        save();
    }
    if(gamenow==0){
        say("Welcome to HumanOS. Type 'help' for help \n");
        while(input!="help")
        {
            printf("$ ");
            cin>>input;
            output(input);
        }
        gamenow=1;
        save();
    }
    if(gamenow==1)
    {
        say("* HELPLESS? 怎么回事? ? 今天也不是……为什么终端上有我的想法? ! \n");
        say("* 虽然好像实时记录思维流也是 HumanOS 提供的服务, 但应该是额外付费的才对…… \n");
        say("* 啊啊, 看着自己的想法委实很奇怪呢 \n");
        say("* 不知道 'help' 命令是什么情况, 登出上网查查好了 \n");
        while(input!="exit"&&input!="logout")
        {
            printf("$ ");
            cin>>input;
            output(input);
        }
        gamenow=2;
        save();
    }
    if(gamenow==2)
    {
        say("* 不能登出? ! \n");
        say("* User, 你好像遇到了麻烦? \n");
        say("* 我是具有人工智能的、系统参考手册的接口 'human' \n");
        say("* 要是你问我和 'man' 什么关系……可能我是他的无性别 Human OS 特供版? \n");
        say("* 噢说回正题, 不能登出就说明, 你可能不幸的, 呃, 已经变成植物人了 \n");
        say("* 然后你的一缕意识被保存在了终端中 \n");
        say("* ……从这个角度看你还是很幸运的 \n");
        say("* 有什么问题使用 'human' 命令我就会出现哦 \n");
        say("* 植物人……我之前在家……在家……在家……好痛! \n");
        say("* 什么也想不起来了 \n");
        say("* 寄! \n");
        say("* 至少可以肯定的是我死在家里, 这比在大街上被人捅死安全多了 \n");
        while(input!="human")
        {
            printf("$ ");
            cin>>input;
            output(input);
        }
        gamenow=3;
        save();
    }
    if(gamenow==3)
    {
        fastsay("* 例如, 尝试使用 human human. \n");
    }
    return 0;
}

inline void output(string s)
{
    if(s=="help")
    {
        printf("You are HELPLESS. No one will help you. jaja. \n");
        return;
    }
    else if(s=="human")
    {
        if(gamenow<2)
        {
            cout<<s<<": permission. \n";
            return;
        }
        else
        {
            fastsay("* 您需要什么手册页? \n");
        }
    }
    else if(s=="restart")
    {
        say("你确定吗? \n");
        while(input!="yes"&&input!="no")
        {
            printf("$ ");
            cin>>input;
            if(input!="yes"&&input!="no")
            {
                cout<<s<<": command not found. \n";
            }
        }
        if(input=="yes")
        {
            say("好的, 你将重新开始 \n");
            gamenow=0;
            save();
            system("cls");
            Sleep(1000);
            main();
        }
        else
        {
            say("好吧, 看来你不想重新开始\n ");
        }
    } 
    else
    {
        cout<<s<<": command not found. \n";
    }
}

inline void readin()
{
    ifstream in("talker.in");
    in>>gamenow;
    in.close();
}

inline void save()
{
    ofstream out("talker.in");
    out<<gamenow;
    out.close();
}

inline ll read()
{
    char ch=getchar();
    ll s=0,w=1;
    while(ch<'0'||ch>'9')
    {
        if(ch=='-'){w=-1;}
        ch=getchar();
    }
    while(ch>='0'&&ch<='9')
    {
        s=(s<<1)+(s<<3)+ch-48;
        ch=getchar();
    }
    return w*s;
}

inline void write(ll x)
{
    if(x<0)
    {
        putchar('-');
        x=-x;
    }
    if(x>9)write(x/10);
    putchar(x%10+'0');
}

inline void say(string a) 
{
    int l=a.size();
    for(int i=0;i<l;i++)
    {
        cout<<a[i];
        Sleep(50);
    }
    Sleep(200);
}

inline void fastsay(string a) 
{
    int l=a.size();
    for(int i=0;i<l;i++)
    {
        cout<<a[i];
        Sleep(5);
    }
    Sleep(50);
}

求赞/kel