V 0.3.3 版本
将 OIcoach.cpp , Library.h 和 Tools.h 放在同一个文件夹内然后运行 OIcoach.cpp 即可.
编译系统要求 C++17 及以上,Windows 系统.
Tools.h
// Copyright (C) since 2026 _auto_ / hwz007
// All rights reserved
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
mt19937 mrand(time(0));
class IORedirector{
private:
streambuf* old_cin_buf;
streambuf* old_cout_buf;
ifstream input_file;
ofstream output_file;
bool input_redirected;
bool output_redirected;
public:
explicit IORedirector(const string& in_file = "", const string& out_file = "")
: old_cin_buf(nullptr), old_cout_buf(nullptr),
input_redirected(false), output_redirected(false){
if(!in_file.empty()){
input_file.open(in_file);
if(input_file.is_open()){
old_cin_buf = cin.rdbuf(input_file.rdbuf());
input_redirected = true;
}else{
system("cls");
cout << "错误 : 找不到指定文件 " << in_file << "\n";
exit(0);
}
}
if(!out_file.empty()){
output_file.open(out_file);
if(output_file.is_open()){
old_cout_buf = cout.rdbuf(output_file.rdbuf());
output_redirected = true;
}
}
}
~IORedirector(){
if(input_redirected && old_cin_buf){
cin.rdbuf(old_cin_buf);
if(output_redirected && old_cout_buf){
cout.rdbuf(old_cout_buf);
}
}
if(output_redirected && old_cout_buf){
cout.rdbuf(old_cout_buf);
}
}
IORedirector(const IORedirector&) = delete;
IORedirector& operator=(const IORedirector&) = delete;
IORedirector(IORedirector&& other) noexcept
: old_cin_buf(other.old_cin_buf),
old_cout_buf(other.old_cout_buf),
input_redirected(other.input_redirected),
output_redirected(other.output_redirected){
other.old_cin_buf = nullptr;
other.old_cout_buf = nullptr;
other.input_redirected = false;
other.output_redirected = false;
}
};
namespace Color{
const string reset = "\033[0m";
const string red = "\033[31m";
const string green = "\033[32m";
const string yellow = "\033[33m";
const string blue = "\033[34m";
const string magenta = "\033[35m";
const string cyan = "\033[36m";
const string white = "\033[37m";
const string bold = "\033[1m";
}
const string SAVE = "Copyright (C) since 2026 _auto_ / hwz007\nAll rights reserved\n\n";
const string NOW_V = "V 0.4.0\n\n";
const vector<string> UPDATE_DAILY = {
"V 0.1.1 更新内容 : \n 1. 优化了 \"集训\" 界面显示\n 2. 移除了彩蛋,并修复了无限刷钱的 Bug\n\n",
"V 0.1.2 更新内容 : \n 1. 更好的操作系统\n\n",
"V 0.1.3 更新内容 : \n 1. 优化代码架构,提升运行速度\n\n",
"V 0.1.4 更新内容 : \n 1. 现在,打开调试工具需要管理员权限\n\n",
"V 0.2.0 更新内容 : \n 1. 主界面会随机显示批话(摘自洛谷用户 dAniel_lele )\n\n",
"V 0.3.0 更新内容 : \n 1. 新增存档功能,游戏内每周自动存档\n 2. 修复若干 Bug\n\n",
"V 0.3.1 更新内容 : \n 1. 比赛功能开启内测\n\n",
"V 0.3.2 更新内容 : \n 1. 优化比赛系统\n\n",
"V 0.3.3 更新内容 : \n 1. 优化比赛系统\n 2. 调整代码架构,隐藏调试工具\n 3. 修复若干 Bug\n\n"
"V 0.4.0 更新内容 : \n 1. 完善比赛系统,添加游戏胜利目标\n 2. 修复若干 Bug\n\n"
};
const string PASSWORD = "PenaltyKingAKIOI";
const vector<string> BULLSHIT = {
"\"当你在幻想上天会给你开一扇窗的时候,你已经输一半了\"",
"\"不要害怕跟比自己强的人对线。当他已经无理到用自己的强弱来对线时,这个人已经无药可救了\"",
"\"永远拿着早就不属于自己的能力在欺骗\"",
"\"由俭入奢易,由奢入俭难。谁不曾幻想多当一会儿赢家呢,只是幻想永远是幻想罢了\"",
"\"脑子不好是硬伤\"",
"\"如果平时训练的时候没有压力每天摆烂从不从自己身上找原因,正式考完需要承担原本可以分摊到每天的压力\"",
"\"有些事情,你没有必要对它有责任感,毕竟没有人对它有责任感\"",
"\"戒一周游戏都戒不明白吗?\"",
"\"让每一个时刻的你,不要成为另一个时刻的累赘。仅此而已\"",
"\"活在这里…好累…如果上天不愿意让我活在一具能赢的躯体,能不能至少让我活在一具输了也不会难受的…\"",
"\"因为别人比自己强而讨厌他/她是正常的吗…\"",
"\"不要去思考未来,把这留给未来的你\"",
"\"该认真一点了,他们已经超越你了,为什么还不端正态度?以前的你会因为这个天天夜夜破防,现在的你为何别得这般无耻?\"",
"\"享受胜利就像吸毒,没有意义,容易上瘾,使人麻痹,无法持续\"",
"\"为了守住友谊而看淡竞争,而不是为了看淡竞争而守住友谊\"",
"\"你不能只在别人比你菜的时候才把别人当成朋友\"",
"\"你羡慕啥呢?别人不过是学术比你强,脑子比你牛,天赋比你高,学习比你卷,干事效率比你高,进步比你快,性格比你好,人际关系比你好,情感比你赢,前途比你广,看不起你罢了,有什么好羡慕的呢?对吧?\"",
"\"你不能只在你输的时候才想到要努力\"",
"\"活着是干啥的是应该放在如何活着之前思考的吗?还是说都是毫不值得思考的问题\"",
"\"把世界幻想得太简单,把自己幻想得太幸运\"",
"\"日常做题过一个题理应与打比赛过一个题获得相同的成就感。别再执着于面子\"",
"\"有过过去不代表会有未来\"",
"\"又有谁会记住自己无心立下的承诺\"",
"\"积极乐观,不意味着也不应基于忘却乃至回避那段不堪而屈辱的过去\"",
"\"自信不应当靠虚伪成就\"",
"\"不要为功利的一丝希望而活,你的人生不止有它,它也不配占据你活着的全部理由\"",
"\"当你没能达到目标的时候,反思一下你定目标的能力\"",
"\"渴望改变别人观点使别人认同自己是一件极度愚蠢且自负的行为\"",
"\"运气在信息学竞赛中没有用,请不要为你水平菜找借口说运气不好\""
};
Library.h
// Copyright (C) since 2026 _auto_ / hwz007
// All rights reserved
#include "Tools.h"
struct _OIer{
string name, happy;
int good, trait;
};
vector<_OIer> OIer;
vector<int> scofNOIP;
struct _Contests{
string name;
int day, tim;
vector<int> hard, trait;
};
vector<_Contests> Contests;
struct _Cutoff{
string name, rea;
int val;
};
vector<_Cutoff> Cutoff;
int MONEY, WEEK;
bool ISADMIN, ISNEW;
string NOWSAVE;
void mycls(string s = ""){system("cls");}
void GetMoney(int x){MONEY += x;}
void turnWeek(){WEEK++; GetMoney(500);}
void NoworkVoid(string s){return;}
void mypau(string c, void work(string s) = NoworkVoid){cout << c; system("pause"); work("");}
int NoworkInt(string s){return 0;}
string NoworkString(string s){return "";}
string ReaRes(string s){return s;}
bool checkJ(string s, string t, void work(string s)){
cout << s << "\n";
string c = "\n"; getline(cin, c);
work(c);
return t == "ALL" || c == t;
}
bool checkJ(string s, vector<string> t, void work(string s)){
cout << s << "\n";
string c = "\n"; getline(cin, c);
work(c);
for(auto x : t)
if(c == x) return true;
return t == (vector<string>){"ALL"};
}
int checkJ(string s, string t, int work(string s)){
cout << s << "\n";
string c = "\n"; getline(cin, c);
return work(c);
}
string checkJ(string s, string t, string work(string s)){
cout << s << "\n";
string c = "\n"; getline(cin, c);
return work(c);
}
void printH(string s, int del){
for(auto x : s){
cout << x; Sleep(del);
}
}
void buildSave(string s){NOWSAVE = s + ".OIcoachSave", ISNEW = true;}
void Save(string key = "SAVE"){
mycls();
IORedirector redirect("", NOWSAVE);
cout << key << " ";
cout << OIer.size() << " ";
for(auto [x, y, z, w] : OIer){
cout << x << " " << y << " " << z << " " << w << " ";
}
for(auto x : scofNOIP) cout << x << " ";
cout << Contests.size() << " ";
for(auto [x, y, z, u, v] : Contests){
cout << x << " " << y << " " << z << " ";
cout << u.size() << " ";
for(auto _ : u) cout << _ << " ";
for(auto _ : v) cout << _ << " ";
}
for(auto [x, y, z] : Cutoff){
cout << x << " " << y << " " << z << " ";
}
cout << MONEY << " " << WEEK << " " << ISADMIN << " ";
}
void loadSave(string s){
NOWSAVE = s + ".OIcoachSave";
IORedirector redirect(NOWSAVE, "");
string c; cin >> c;
if(c == "OVER"){
mycls();
cout << "该存档游戏已结束,无法载入\n\n";
exit(0);
}else if(c != "SAVE"){
mycls();
cout << "错误 : 文件 " << NOWSAVE << " 校验码错误,请检查它是否是你的游戏存档\n\n";
exit(0);
}
int n; cin >> n;
for(int i = 1; i <= n; i++){
string x, y; int z, w;
cin >> x >> y >> z >> w;
OIer.push_back({x, y, z, w});
}
for(int i = 1; i <= n; i++){
int x; cin >> x;
scofNOIP.push_back(x);
}
int m; cin >> m;
for(int i = 1; i <= m; i++){
string x; int y, z;
cin >> x >> y >> z;
vector<int> u, v; int siz;
cin >> siz;
for(int j = 0; j < siz; j++){
int x; cin >> x;
u.push_back(x);
}
for(int j = 0; j < siz; j++){
int x; cin >> x;
v.push_back(x);
}
Contests.push_back({x, y, z, u, v});
}
for(int i = 1; i <= m; i++){
string x, y; int val;
cin >> x >> y >> val;
Cutoff.push_back({x, y, val});
}
cin >> MONEY >> WEEK >> ISADMIN;
}
void checkSave(string s){
mycls();
if(s == "1"){
checkJ("请输入新建存档名:", "ALL", buildSave);
mypau("\n创建成功 !\n", mycls);
Save();
}else if(s == "2"){
checkJ("请输入载入存档名:", "ALL", loadSave);
mypau("\n载入成功 !\n", mycls);
}
}
void turnUTF(){system("chcp 65001");mycls();}
void GameOver(string rea){
cout << "\n";
if(rea == "student") printH("你没有了学员\n\n游戏结束 !!\n", 30);
if(rea == "money") printH("你破产了\n\n游戏结束 !!\n", 30);
if(rea == "teacher") printH("你辞职了\n\n游戏结束 !!\n", 30);
mypau("\n"); Save("OVER");
exit(0);
}
void AFO(string name, string rea){
cout << name << " 因为" << rea << "而退役" << "\n\n";
vector<_OIer> newOIer;
vector<int> newscofNOIP;
for(int i = 0; i < OIer.size(); i++){
auto [x, y, z, w] = OIer[i];
if(x != name){
newOIer.push_back({x, y, z, w});
newscofNOIP.push_back(scofNOIP[i]);
}
}
OIer = newOIer;
scofNOIP = newscofNOIP;
if(OIer.empty()) GameOver("student");
}
void PrintTime(){
cout << "第 " << WEEK << " 周 " ;
for(auto [x, y, z, u, v] : Contests){
if(WEEK < y){
cout << "距离 " << x << " 还有 " << y - WEEK << " 周";
break;
}
}
cout << "\n\n";
}
void PrintMoney(){cout << " 经费 : " << MONEY << " $\n\n";}
void PrintShit(){cout << BULLSHIT[mrand() % BULLSHIT.size()] << "\n\n\n";}
string PrintHappy(string s){
if(s == "低") return Color::green + s + Color::reset;
if(s == "中") return Color::yellow + s + Color::reset;
if(s == "高") return Color::bold + Color::red + s + Color::reset;
if(s == "极高") return Color::red + s + Color::reset;
if(s == "爆表") return Color::red + s + Color::reset;
return "";
}
void PrintOIer(){
for(auto [x, y, z, w] : OIer){
cout << x << " 压力 : " << PrintHappy(y) << " 能力 : " << z << "\n\n";
}
}
void InitMoney(){MONEY = 50000;}
void InitWeek(){WEEK = 1;}
void InitOIer(){
OIer.push_back({"周康阳", "低", 100, int(mrand() % 100 + 1)});
OIer.push_back({"许琪文", "低", 100, int(mrand() % 100 + 1)});
OIer.push_back({"蒋凌宇", "低", 100, int(mrand() % 100 + 1)});
OIer.push_back({"邓明扬", "低", 100, int(mrand() % 100 + 1)});
scofNOIP.resize(OIer.size());
}
void InitContest(){
Contests.push_back({"CSP-S初赛", 5, 120, (vector<int>){200}, (vector<int>){int(mrand() % 100 + 1)}});
Contests.push_back({"CSP-S复赛", 9, 240, (vector<int>){60, 120, 180, 320}, (vector<int>){int(mrand() % 100 + 1), int(mrand() % 100 + 1), int(mrand() % 100 + 1), int(mrand() % 100 + 1)}});
Contests.push_back({"NOIP", 13, 270, (vector<int>){80, 160, 200, 360}, (vector<int>){int(mrand() % 100 + 1), int(mrand() % 100 + 1), int(mrand() % 100 + 1), int(mrand() % 100 + 1)}});
Contests.push_back({"省选", 18, 600, (vector<int>){180, 240, 380, 220, 260, 340}, (vector<int>){int(mrand() % 100 + 1), int(mrand() % 100 + 1), int(mrand() % 100 + 1), int(mrand() % 100 + 1), int(mrand() % 100 + 1), int(mrand() % 100 + 1)}});
Contests.push_back({"NOI", 25, 600, (vector<int>){200, 280, 440, 240, 260, 480}, (vector<int>){int(mrand() % 100 + 1), int(mrand() % 100 + 1), int(mrand() % 100 + 1), int(mrand() % 100 + 1), int(mrand() % 100 + 1), int(mrand() % 100 + 1)}});
Cutoff.push_back({"CSP-S复赛晋级线:", "未晋级CSP-S复赛", 55 + (int)mrand() % 10});
Cutoff.push_back({"NOIP晋级线:", "未晋级NOIP", 170 + (int)mrand() % 20});
Cutoff.push_back({"NULL", "NULL", 0});
Cutoff.push_back({"省队队线(7.5%NOIP+11.7%省选分数):", "未进入省队", 75 + (int)mrand() % 5});
Cutoff.push_back({"NOI国集线:", "未进入国集", 550 + (int)mrand() % 20});
}
void Init(){
InitMoney(); InitWeek();
InitOIer(); InitContest();
}
void Print(){
PrintTime(); PrintShit();
PrintMoney(); PrintOIer();
}
int checkCont(){
for(int i = 0; i < Contests.size(); i++){
auto [x, y, z, u, v] = Contests[i];
if(WEEK == y) return i;
}
return -1;
}
void PrintContest(string name, int tim, int ntim, int sizn, int sizm, vector<vector<double>> sc, vector<vector<int>> psc, vector<int> cho){
mycls();
cout << name << " " << ntim << " / " << tim << " min\n\n ";
for(int i = 0; i < sizm; i++){
cout << setw(6) << "T" << i + 1;
}
cout << "\n";
for(int i = 0; i < sizn; i++){
auto [x, y, z, w] = OIer[i];
cout << x;
for(int j = 1; j <= 5 - x.size() / 3; j++)
cout << " ";
for(int j = 0; j < sizm; j++){
for(int k = psc[j].size() - 1; k >= 0; k--){
if(sc[i][j] >= psc[j][k]){
if(j == cho[i]) cout << Color::bold;
string s = to_string(psc[j][k]);
s.insert(0, 7 - s.size(), ' ');
if(psc[j][k] == 0)
cout << Color::reset << s << Color::reset;
else if(psc[j][k] < 30)
cout << Color::red << s << Color::reset;
else if(psc[j][k] < 70)
cout << Color::yellow << s << Color::reset;
else
cout << Color::green << s << Color::reset;
if(j == cho[i]) cout << Color::reset;
break;
}
}
}
cout << "\n";
}
Sleep(200);
}
void Jump(int id, int u, int sizm, vector<vector<double>> sc, vector<int>& cho, vector<int>& lst){
vector<pii> h;
int sum = 0;
for(int i = 0; i < sizm; i++){
sum += sqrt(u) * (100 - sc[id][i]);
if(i != cho[id]) h.push_back({sum, i});
}
if(sum == 0) return;
int mcho = mrand() % sum;
for(int i = 0; i < h.size(); i++){
auto [s, k] = h[i];
if(mcho < s){
cho[id] = k, lst[id] *= 0.6;
return;
}
}
}
void Win(){
for(auto [x, y, z, w] : OIer){
cout << x << " " << "进入了国集 !\n";
}
mypau("\n"); mycls();
printH("你的学员进入了国集,你是一名优秀的教练 !\n\n游戏胜利 !!\n", 30);
mypau("\n"); Save("OVER"); exit(0);
}
void Contest(int id){
auto [name, day, tim, hard, trait] = Contests[id];
int sizn = OIer.size(), sizm = hard.size();
vector<vector<double>> sc(sizn);
for(int i = 0; i < sizn; i++){
sc[i].resize(sizm);
}
vector<int> cho(sizn);
vector<int> lst(sizn);
vector<double> pw(sizn, 1);
vector<vector<int>> psc(sizm);
for(int i = 0; i < sizm; i++){
int task = mrand() % 2 ? 5 : 4;
int sizt = mrand() % 5 + 4;
vector<int> tasks;
tasks.push_back(0);
tasks.push_back(100);
for(int j = 1; j <= sizt; j++){
tasks.push_back(mrand() % (100 / task) * task);
}
sort(tasks.begin(), tasks.end());
tasks.erase(unique(tasks.begin(), tasks.end()), tasks.end());
psc[i] = tasks;
}
for(int i = 5; i <= tim; i += 5){
PrintContest(name, tim, i, sizn, sizm, sc, psc, cho);
for(int j = 0; j < sizn; j++){
auto [x, y, z, w] = OIer[j];
int u = hard[cho[j]];
int v = trait[cho[j]];
lst[j] += 5;
double p = 0.00004L * (100 - mrand() % 50) * sqrt(1.0 * z / u) * (log(lst[j]) * log(lst[j])) * ((w ^ v) + 150) * pw[j];
sc[j][cho[j]] = min(100.0, sc[j][cho[j]] + p);
if(sc[j][cho[j]] == 100 || mrand() % 20000 <= lst[j] * lst[j])
Jump(j, u, sizm, sc, cho, lst);
pw[j] = pw[j] * 0.97;
}
}
mypau("\n");
if(id == 2){ // NOIP
for(int i = 0; i < sizn; i++){
int sum = 0;
for(int j = 0; j < sizm; j++){
for(int k = psc[j].size() - 1; k >= 0; k--){
if(sc[i][j] >= psc[j][k]){
sum += psc[j][k]; break;
}
}
}
scofNOIP[i] = sum;
}
}else{
auto [_name, rea, val] = Cutoff[id];
cout << "\n" << _name << val << "\n\n";
bool flag = true;
while(flag){
flag = false;
for(int i = 0; i < sizn; i++){
int sum = 0;
for(int j = 0; j < sizm; j++){
for(int k = psc[j].size() - 1; k >= 0; k--){
if(sc[i][j] >= psc[j][k]){
sum += psc[j][k]; break;
}
}
}
double lstsc = sum;
if(id == 3)
lstsc = 0.117 * sum + 0.075 * scofNOIP[i]; // 省选
if(lstsc < val){
AFO(OIer[i].name, rea), Sleep(200);
flag = true, sizn--; break;
}
}
}
mypau("\n");
if(id == 4) Win(); // NOI
}
}
void checkMoney(){if(MONEY < 0) GameOver("money");}
int checkPro(string s){return s[0] - '0';}
int calcProN(int x){return 20 * x - 10;}
int calcProG(int x){return 5 * x;}
string nxtHappy(string x){
if(x == "低") return "中";
if(x == "中") return "高";
if(x == "高") return "极高";
if(x == "极高") return "爆表";
if(x == "爆表") return "爆表";
return "";
}
string nxtLowHappy(string x){
if(x == "低") return "低";
if(x == "中") return "低";
if(x == "高") return "中";
if(x == "极高") return "高";
return "";
}
string changeHappy(string x, int y, string name){
string sx = x;
while(y > 100){
x = changeHappy(x, 100, name);
y -= 100;
}
int rnd = mrand() % 100 + 1;
if(rnd <= y) x = nxtHappy(x);
if((sx == "低" || sx == "中") && x == "爆表") x = "极高";
return x;
}
string changeLowHappy(string x, int y){
while(y > 100){
x = changeLowHappy(x, 100);
y -= 100;
}
int rnd = mrand() % 100 + 1;
if(rnd <= y) x = nxtLowHappy(x);
return x;
}
int changeGood(int x, int y){
int rnd = mrand() % 3 + 1;
return x + y * rnd;
}
void checkHappy(int mod){
bool canMod = false;
while(true){
bool flag = false;
for(auto [x, y, z, w] : OIer){
if(y == "爆表"){
flag = true, canMod = true;
AFO(x, "压力过大"); Sleep(300); break;
}
}
if(!flag) break;
}
if(mod && canMod) mypau("", mycls);
}
void checkOver(int mod = 0){
checkMoney();
checkHappy(mod);
}
OIcoach.cpp
// Copyright (C) since 2026 _auto_ / hwz007
// All rights reserved
#include "library.h"
void Training(){
mycls();
int cho = checkJ("请选择题目难度 : \n1.入门 2.普及- 3.普及/提高- 4.普及+/提高 5.提高+/省选- 6.省选/NOI- 7.NOI/NOI+/CTSC", "ALL", checkPro);
while(cho < 1 || cho > 7){
mycls();
cho = checkJ("请选择题目难度 : \n1.入门 2.普及- 3.普及/提高- 4.普及+/提高 5.提高+/省选- 6.省选/NOI- 7.NOI/NOI+/CTSC", "ALL", checkPro);
}
int ProN = calcProN(cho), ProG = calcProG(cho);
mycls();
for(int i = 1; i <= 6; i++){
cout << "训练中";
for(int j = 1; j <= i % 3 + 1; j++)
cout << ".";
cout << "\n";
Sleep(150); mycls();
}
cout << "训练完成 !" << "\n\n";
cout << "训练结果 :" << "\n\n";
cout << "经费 : " << MONEY << " -> " << (MONEY -= 1000) << "\n\n";
Sleep(500);
for(int i = 0; i < (int)OIer.size(); i++){
auto [x, y, z, w] = OIer[i];
cout << x << " 压力 : " << PrintHappy(y) << " -> " << PrintHappy(OIer[i].happy = changeHappy(y, ProN, x)) << " 能力 : " << OIer[i].good << " -> " << (OIer[i].good = changeGood(z, ProG)) << "\n\n";
Sleep(200);
}
checkOver();
mypau("", mycls); turnWeek();
}
void Camp(){
int newMoney = MONEY;
vector<_OIer> bx;
for(auto [x, y, z, w] : OIer){
mycls();
cout << "请选择参加集训的人员 : " << "\n\n";
cout << x << " 压力 : " << y << " 能力 : " << z << "\n";
cout << "你希望 " << x << " 参加集训吗 ( 希望请输入 'Y' 或 'y' ) 预计剩余经费 : " << MONEY << " -> " << newMoney - 10000 << "\n";
string cho = checkJ("", "ALL", ReaRes);
if(cho == "Y" || cho == "y"){
newMoney -= 10000;
bx.push_back({x, y, z, w});
}
}
mycls();
for(int i = 1; i <= 6; i++){
cout << "集训中";
for(int j = 1; j <= i % 3 + 1; j++)
cout << ".";
cout << "\n";
Sleep(150); mycls();
}
cout << "集训完成 !" << "\n\n";
cout << "集训结果 :" << "\n\n";
cout << "经费 : " << MONEY << " -> " << (MONEY = newMoney) << "\n\n";
Sleep(500);
for(auto [x, y, z, w] : bx){
for(int i = 0; i < (int)OIer.size(); i++){
if(OIer[i].name != x) continue;
cout << x << " 压力 : " << PrintHappy(y) << " -> " << PrintHappy(OIer[i].happy = changeHappy(y, 250, x)) << " 能力 : " << z << " -> " << (OIer[i].good = changeGood(z, 50)) << "\n\n";
Sleep(200); break;
}
}
checkOver();
mypau("", mycls); turnWeek();
}
void Competition(){
mycls();
cout << "功能仍在开发中哟~" << "\n";
mypau("", mycls);
}
void Entertainment(){
mycls();
for(int i = 1; i <= 6; i++){
cout << "娱乐中";
for(int j = 1; j <= i % 3 + 1; j++)
cout << ".";
cout << "\n";
Sleep(150); mycls();
}
cout << "娱乐完成 !" << "\n\n";
cout << "娱乐结果 :" << "\n";
for(int i = 0; i < (int)OIer.size(); i++){
auto [x, y, z, w] = OIer[i];
cout << x << " 压力 : " << PrintHappy(y) << " -> " << PrintHappy(OIer[i].happy = changeLowHappy(y, 120)) << "\n\n";
Sleep(200);
}
mypau("", mycls); turnWeek();
}
void Quit(){
mycls();
string cho = checkJ("确认辞职吗 ( 确认请输入 'Y' 或 'y' )", "ALL", ReaRes);
if(cho == "Y" || cho == "y"){
mycls();
GameOver("teacher");
}
}
void ChangeMoney(string x){
MONEY = stoi(x);
mypau("\n修改完成 ! \n\n", mycls);
}
void ChangeWeek(string x){
WEEK = stoi(x);
mypau("\n修改完成 ! \n\n", mycls);
}
bool NotFindHappy(string s){
if(s == "低") return false;
if(s == "中") return false;
if(s == "高") return false;
if(s == "极高") return false;
if(s == "爆表") return false;
return true;
}
void ChangeOIer(string id){
mycls();
int zid = stoi(id);
if(zid < 1 || zid > (int)OIer.size()){
mypau("\n错误 : 未找到该 OIer\n\n", mycls);
return;
}
cout << OIer[zid - 1].name << " 原压力 : " << OIer[zid - 1].happy << " 原能力 : " << OIer[zid - 1].good << "\n\n";
string newHappy = checkJ("\n你要将 " + OIer[zid - 1].name + " 的压力值改为 : ", "ALL", ReaRes);
int newGood = stoi(checkJ("\n你要将 " + OIer[zid - 1].name + " 的能力值改为 : ", "ALL", ReaRes));
if(NotFindHappy(newHappy)){
mypau("\n错误 : 压力值输入错误\n\n", mycls);
return;
}
OIer[zid - 1].happy = newHappy;
OIer[zid - 1].good = newGood;
mypau("\n修改完成 ! \n\n", mycls);
checkOver(1);
}
void DeMoney(){
mycls();
checkJ("\n你要将 MONEY 修改为 : ", "ALL", ChangeMoney);
}
void DeWEEK(){
mycls();
checkJ("\n你要将 WEEK 修改为 : ", "ALL", ChangeWeek);
}
void DeOIer(){
mycls();
int cnt = 0;
for(auto [x, y, z, w] : OIer){
cout << ++cnt << ". " << x << " 压力 : " << y << " 能力 : " << z << "\n\n";
}
checkJ("你要将谁的数据修改 ( 输入编号 ) : ", "ALL", ChangeOIer);
}
void checkDe(string s){
if(s == "1") DeMoney();
else if(s == "2") DeWEEK();
else if(s == "3") DeOIer();
}
void Debug(){
mycls();
checkJ("请选择要修改的数据: \n1.MONEY 2.WEEK 3.OIer_data 4.退出", "ALL", checkDe);
}
void Log(){
mycls();
cout << SAVE << "当前版本 : " << NOW_V;
for(auto x : UPDATE_DAILY)
cout << x;
mypau("", mycls);
}
void Exit(){mycls(); exit(0);}
void checkit(string s){
if(ISADMIN){
if(s == "1") Training();
if(s == "2") Camp();
if(s == "3") Competition();
if(s == "4") Entertainment();
if(s == "5") Quit();
if(s == "6") Debug();
if(s == "7") Log();
if(s == "8") Exit();
}else{
if(s == "1") Training();
if(s == "2") Camp();
if(s == "3") Competition();
if(s == "4") Entertainment();
if(s == "5") Quit();
if(s == "6") Log();
if(s == "7") Exit();
if(s == PASSWORD) ISADMIN = true, Debug();
}
}
void GameLoop(){
Save();
int posCont = checkCont();
if(posCont != -1){
Contest(posCont);
turnWeek();
}else{
Print();
if(ISADMIN){
if(MONEY > 10000)
checkJ("请选择:\n1.训练 (-1000 $) 2.集训 (-10000 ~ " + to_string(10000 * min(MONEY / 10000, (int)OIer.size())) + " $) 3.模拟赛(开发中) 4.娱乐 5.辞职 6.调试工具 7.更新日志 8.退出", "ALL", checkit);
else
checkJ("请选择:\n1.训练 (-1000 $) 2.集训 (-10000 $) 3.模拟赛(开发中) 4.娱乐 5.辞职 6.调试工具 7.更新日志 8.退出", "ALL", checkit);
}else{
if(MONEY > 10000)
checkJ("请选择:\n1.训练 (-1000 $) 2.集训 (-10000 ~ " + to_string(10000 * min(MONEY / 10000, (int)OIer.size())) + " $) 3.模拟赛(开发中) 4.娱乐 5.辞职 6.更新日志 7.退出", "ALL", checkit);
else
checkJ("请选择:\n1.训练 (-1000 $) 2.集训 (-10000 $) 3.模拟赛(开发中) 4.娱乐 5.辞职 6.更新日志 7.退出", "ALL", checkit);
}
checkOver();
}
}
void Story(){
printH("[背景故事] 你是一名 OI 教练,你的任务是带领学员进入国集...\n\n", 30);
mypau("", mycls);
}
int main(){
turnUTF();
mypau("OI 教 练 模 拟 器\n\n", mycls);
while(!checkJ("请选择:\n1.新建存档 2.载入存档", (vector<string>){"1", "2"}, checkSave))
mycls();
if(ISNEW){Init(); Story();}
while(true) GameLoop();
return 0;
}