1.文明模拟器
代码末尾有 ‘样例’
#include<iostream>
#include<cstdio>
#include<fstream>
#include<algorithm>
#include<cmath>
#include<deque>
#include<vector>
#include<queue>
#include<string>
#include<cstring>
#include<map>
#include<stack>
#include<set>
#include<windows.h>
#include<conio.h>
#include<ctime>
using namespace std;
const int maxn = 100000;
const int sleep = 500; //屏幕速度
struct civil { //文明
int level;
vector<int>planets;
string name;
bool alive;
bool xg = false;
bool hq = false;
bool hl = false;
bool hy = false;
bool xy = false;
bool sw = false;
int ki = 1;
} c[maxn];
struct planet { //星球
int dist;
int belong;
string name;
bool xg = false;
bool hq = false;
bool hl = false;
bool hy = false;
bool xy = false;
bool sw = false;
} p[maxn];
struct warship { //舰队
int from;
int frompl;
int to;
int ti;
warship() {}
warship(int _frompl, int _to, int _ti): from(p[_frompl].belong),
frompl(_frompl), to(_to), ti(_ti) {}
};
bool operator<(warship a, warship b) {
return a.ti > b.ti;
}
// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
string lv[] = {"蛮荒时代", "石器时代", "青铜时代", "铁器时代", "火器时代", "蒸汽时代", "电气时代", "信息时代", "量子时代", "无限能源时代", "机械时代", "跨恒星广播能力", "1/100光速航行", "1/10光速航行", "1/5光速航行", "亚光速航行", "光速航行", "超光速航行", "虫洞跨越", "超曲率航线", "光粒打击", "二向箔打击"};
string destroy[] = {"严寒", "烈焰", "大撕裂", "双日凌空", "三日凌空", "三日连珠", "伽马风暴", "流浪黑洞", "母星寿尽", "恒星塌缩", "流浪恒星"};
string kind[] = {"硅基生命", "碳基生命", "能量生命"};
// 1 2 3 4 5 6 7 8 9 10 11
priority_queue<warship>q, r;
int sum;
void lose(int id);
string sFromInt(int x);
int main() {
srand(time(0));
system("COLOR 0A");
//freopen("ST.in","r",stdin);
//freopen("ST.out","w",stdout);
int i, j, n, year, cnt;
unsigned int sd = 2333;
cout << "文明的数量:";
cin >> n; //输入:第一行字符串个数,接下来若干行字符串
sum = n;
cout << n << "个文明的名字:" << endl;
for (i = 1; i <= n; i++) {
cout << i << ". ";
cin >> c[i].name;
p[i].name = c[i].name;
unsigned int tmp = 622;
for (j = 0; j < c[i].name.size(); j++) tmp = 703 * tmp + c[i].name[j];
sd = sd * 3071 + tmp;
c[i].level = 0;
int tq = rand() % 20;
if (tq == 0) {
tq = rand() % 20;
if (tq == 0) {
c[i].ki = 2;
c[i].level = 8;
} else {
c[i].ki = 0;
c[i].level = 5;
}
} else {
c[i].ki = 1;
}
if (c[i].name.find("归零") >= 0 &&
c[i].name.find("归零") <= c[i].name.length()) {
c[i].level += rand() % 6 + 5;
}
if (c[i].name.find("高维") >= 0 &&
c[i].name.find("高维") <= c[i].name.length()) {
c[i].level += rand() % 5 + 5;
}
if (c[i].name.find("吞噬") >= 0 &&
c[i].name.find("吞噬") <= c[i].name.length()) {
c[i].level += rand() % 4 + 3;
}
if (c[i].name.find("神") >= 0 && c[i].name.find("神") <= c[i].name.length()) {
c[i].level += rand() % 2 + 1;
}
if (c[i].name.find("命运") >= 0 &&
c[i].name.find("命运") <= c[i].name.length()) {
c[i].level += rand() % 3 + 1;
} else if (c[i].name.find("天命") >= 0 &&
c[i].name.find("天命") <= c[i].name.length()) {
c[i].level += rand() % 2 + 2;
} else if (c[i].name.find("命") >= 0 &&
c[i].name.find("命") <= c[i].name.length()) {
c[i].level += rand() % 2 + 1;
}
if (c[i].name.find("天尊") >= 0 &&
c[i].name.find("天尊") <= c[i].name.length()) {
c[i].level += rand() % 2 + 1;
}
if (c[i].name.find("帝") >= 0 && c[i].name.find("帝") <= c[i].name.length()) {
c[i].level += rand() % 2 + 1;
}
if (c[i].name.find("虫族") >= 0 &&
c[i].name.find("虫族") <= c[i].name.length()) {
c[i].level += rand() % 3 + 1;
c[i].ki = 1;
}
if (c[i].name.find("泰坦") >= 0 &&
c[i].name.find("泰坦") <= c[i].name.length()) {
c[i].level += rand() % 2 + 2;
c[i].ki = 1;
}
if (c[i].name.find("克苏鲁") >= 0 &&
c[i].name.find("克苏鲁") <= c[i].name.length()) {
c[i].level += rand() % 3 + 8;
c[i].ki = 2;
}
if (c[i].name.find("量子") >= 0 &&
c[i].name.find("量子") <= c[i].name.length()) {
c[i].level += rand() % 3 + 8;
c[i].ki = 2;
}
if (c[i].name.find("幽灵") >= 0 &&
c[i].name.find("幽灵") <= c[i].name.length()) {
c[i].level += rand() % 2 + 8;
c[i].ki = 2;
}
if (c[i].name.find("机甲") >= 0 &&
c[i].name.find("机甲") <= c[i].name.length()) {
c[i].level += rand() % 3 + 5;
c[i].ki = 0;
}
if (c[i].name.find("机械") >= 0 &&
c[i].name.find("机械") <= c[i].name.length()) {
c[i].level += rand() % 2 + 5;
c[i].ki = 0;
}
if (c[i].name.find("智能") >= 0 &&
c[i].name.find("智能") <= c[i].name.length()) {
c[i].level += rand() % 5 + 5;
c[i].ki = 0;
}
if (c[i].name.find("赛博") >= 0 &&
c[i].name.find("赛博") <= c[i].name.length()) {
c[i].level += rand() % 4 + 5;
c[i].ki = 0;
}
c[i].level = min(c[i].level, 16);
// cout<<"level:"<<c[i].level<<endl;
c[i].planets.push_back(i);
c[i].alive = true;
p[i].dist = rand() % 100 + 10;
p[i].belong = i;
// c[i].level+=16;
}
system("cls");
cout << "----------初始文明等级----------" << endl;
for (i = 1; i <= n; i++) {
cout << i << ". " << kind[c[i].ki] << "文明" << c[i].name << "-level:";
if (c[i].level <= 21)cout << lv[c[i].level] << endl;
else cout << 10.0 + double(c[i].level) / 2.5 << endl;
}
Sleep(sleep * n / 2);
cout << "宇宙在一片黑暗中诞生了..." << endl;
Sleep(2000);
system("cls");
srand(time(
NULL));//之后的演化会受所有输入名字的共同影响,也会被名字顺序影响
for (i = n + 1; i <= n * 10; i++) { //1~n星球是n个文明的母星
p[i].dist = rand() % 50 + 10;
//n+1~n*2星球是无人星球
p[i].belong = 0;
p[i].name = sFromInt(i - n) + "号";
/*
//n+i星球属于第i个文明
p[i].belong=i-n;
p[i].name=c[i-n].name+"2号";
c[i-n].planets.push_back(i);
*/
}
for (year = 0;; year += rand() % 20) {
// Sleep(sleep);
while (!q.empty() && year > q.top().ti) { //舰队到达
warship now = q.top();
q.pop();
int id = now.to;
i = now.from;
if (p[id].belong == i) continue;
cout << "宇宙历第" << year << "年" << endl;
cout << "来自" << c[i].name << "文明的舰队到达" << p[id].name <<
"星球,";
if (p[id].belong == 0 || (c[p[id].belong].level <= c[i].level &&
rand() % 3 > 0)) {
cout << "并占领了" << p[id].name << "星球" << endl;
lose(id);
p[id].belong = i;
c[i].planets.push_back(id);
if (!c[i].alive) {
cout << c[i].name << "文明重生" << endl;
c[i].alive = true;
sum++;
}
} else {
cout << "攻击失败" << endl;
if (c[p[id].belong].level > 11 && rand() % 100 > 0
) {
cout << p[id].name << "星球广播了" << p[now.frompl].name <<
"星球的位置" << endl;
if (rand() % 2) r.push(warship(0, now.frompl,
rand() % 5 * 10 + year + p[now.frompl].dist + p[id].dist));
}
}
Sleep(sleep);
}
while (!r.empty() && year > r.top().ti) { //黑暗森林打击到达
int id = r.top().to;
r.pop();
cout << "宇宙历第" << year << "年" << endl;
cout << p[id].name << "星球被二向箔降维打击" << endl;
if (p[id].sw == true) {
cout << "但此文明使用反维度打击技术强行升维" << endl;
} else {
lose(id);
p[id].belong = 0;
}
Sleep(sleep);
}
for (i = 1; i <= n; i++) {
if (!c[i].alive) continue;
if (rand() % 400 == 0) { //技术
if (rand() % 40 == 0 && c[i].xg == false && c[i].level >= 7) {
cout << "宇宙历第" << year << "年" << endl;
cout << c[i].name << "文明研发出了行星改造技术。" << endl;
c[i].xg = true;
p[i].xg = true;
Sleep(sleep);
}
if (rand() % 40 == 0 && c[i].xy == false && c[i].level >= 7) {
cout << "宇宙历第" << year << "年" << endl;
cout << c[i].name << "文明研发出了行星延寿技术。" << endl;
c[i].xy = true;
p[i].xy = true;
Sleep(sleep);
}
if (rand() % 40 == 0 && c[i].hl == false && c[i].level >= 9) {
cout << "宇宙历第" << year << "年" << endl;
cout << c[i].name << "文明研发出了恒星利用技术。" << endl;
c[i].hl = true;
p[i].hl = true;
Sleep(sleep);
}
if (rand() % 40 == 0 && c[i].hy == false && c[i].level >= 9) {
cout << "宇宙历第" << year << "年" << endl;
cout << c[i].name << "文明研发出了恒星延寿技术。" << endl;
c[i].hy = true;
p[i].hy = true;
Sleep(sleep);
}
if (rand() % 40 == 0 && c[i].hq == false && c[i].level >= 9) {
cout << "宇宙历第" << year << "年" << endl;
cout << c[i].name << "文明研发出了恒星牵引技术。" << endl;
c[i].hq = true;
p[i].hq = true;
Sleep(sleep);
}
if (rand() % 2 == 0 && c[i].hq == false && c[i].level >= 17) {
cout << "宇宙历第" << year << "年" << endl;
cout << c[i].name << "文明研发出了反维度打击技术。" << endl;
c[i].sw = true;
p[i].sw = true;
Sleep(sleep);
}
int qwe = rand() % 60 + 1;
cout << "宇宙历第" << year << "年" << endl;
if (qwe >= 50) {
cout << c[i].name << "文明发生技术爆炸,";
c[i].level += 2;
} else if (qwe >= 30) {
cout << c[i].name << "文明发生技术突破,";
c[i].level += 1;
} else {
cout << c[i].name << "文明发生技术送代" << endl;
goto Next;
}
if (c[i].level <= 21) {
if (c[i].level < 11) cout << "进入" << lv[c[i].level] << endl;
else cout << "具备" << lv[c[i].level] << "能力" << endl;
} else cout << "等级" << 10.0 + double(double(c[i].level - 10) * 0.17) <<
endl;
Next:
Sleep(sleep);
}
if (rand() % 100 == 0 && c[i].level >= 12 &&
c[i].planets.size() < n * 10) { //发出舰队
int id;
do {
id = rand() % (n * 10) + 1;
} while (p[id].belong == i);
int speed = min(c[i].level, 19);
int d = p[c[i].planets[0]].dist + p[id].dist;
if (speed == 12) d *= 100;
if (speed == 13) d *= 10;
if (speed == 14) d *= 5;
if (speed == 15) d *= 2;
if (speed == 16) d *= 1;
if (speed == 17) d /= 2;
if (speed == 18) d /= 15;
if (speed == 19) d /= 45;
d = d + 1;
if (speed) {
cout << "宇宙历第" << year << "年" << endl;
cout << c[i].name << "文明向" << p[id].name << "星球发出" << lv[speed] <<
"舰队,将在" << d << "年后到达" << endl;
}
q.push(warship(c[i].planets[0], id, year + d));
Sleep(sleep);
}
}
if (rand() % 5000 == 0) { //自然灾害
int id;
do {
id = rand() % (n * 2) + 1;
} while (p[id].belong == 0);
cout << "宇宙历第" << year << "年" << endl;
int q = rand() % 11;
cout << p[id].name << "星球上的文明遭受了" << destroy[q] <<
"灾难,";
if ((q == 0 || q == 1 || q == 2) && p[id].xg == true) {
cout << "但被此文明使用行星改造技术扭转了灾难。" << endl;
} else {
cout << "毁灭了" << endl;
lose(id);
p[id].belong = 0;
Sleep(sleep);
if (sum == 1) {
//system("pause");
return 0;
}
}
}
}
return 0;
}
void lose(int id) {
int i = p[id].belong;
if (i == 0) return;
vector<int>& v = c[i].planets;
vector<int>::iterator it;
for (it = v.begin(); it != v.end(); it++) if (*it == id) break;
v.erase(it);
if (v.size() == 0) {
c[i].alive = false;
sum--;
cout << "--->>" << c[i].name << "文明毁灭了" << endl;
Sleep(sleep * 5);
}
}
string sFromInt(int x) {
string ret;
while (x) {
ret = char(x % 10 + '0') + ret;
x /= 10;
}
return ret;
}
/*
150
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
aq
aw
ae
ar
at
ay
au
ai
ao
ap
aa
as
ad
af
ag
ah
aj
ak
al
az
ax
ac
av
ab
an
am
bq
bw
be
br
bt
by
bu
bi
bo
bp
ba
bs
bd
bf
bg
bh
bj
bk
bl
bz
bx
bc
bv
bb
bn
bm
qa
qw
qs
qe
qd
qz
qx
qc
qr
qf
qt
qg
qv
qy
qh
qb
qh
qu
qj
qn
qi
qm
qk
qo
ql
qp
wq
wa
ws
wz
wx
wc
wd
we
wf
wr
wv
wt
wg
wb
wy
wh
wn
wu
wj
wm
wi
wk
wl
wo
wp
eq
ew
ee
er
et
ey
eu
ei
eo
ep
ea
es
ed
ef
eg
eh
ej
ek
el
ez
ex
ec
ev
eb
en
em
*/
2.修仙模拟器
代码末尾有 ‘样例'
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
const int sleep = 250;
struct node {
string s;
int t;
};
struct people {
long long int xiu; // 修为
string name; // 名字
long long int ti; // 天赋
long long int sho; // 寿命
long long int att; // 战力
bool alife; // 是否存活
double zef; // zhenfu
} p[1001];
// 10 21 32 43 54 65 76 87 98 109 120 131 142 153 164 175 186 197 208 219 230 241 252 263 274 285 296 307 318 329 340 351 362
string xw[10000] = { "凡境", "锻体境", "引灵境", "练气境", "筑基境", "结丹境", "金丹境", "元婴境", "练神境", "化神境", "分神境", "合体境", "渡虚境", "反虚境", "大乘境", "渡劫境", "传说境", "史诗境", "神话境", "飞升境", "羽化境", "登天境", "伪仙境", "人仙境", "地仙境", "天仙境", "真仙境", "金仙境", "混元金仙境", "太乙金仙境", "混元太乙金仙境", "大罗金仙境", "仙王境", "仙尊境", "仙帝境", "仙神境", "伪圣境", "圣人境", "混元大罗金仙境", "圣王境", "圣皇境", "圣帝境", "圣尊境", "圣神境", "混元境", "混沌境", "伪-鸿蒙境", "伪神境", "神境", "神将境", "神尊境", "神王境", "神皇境", "神帝境", "神明境", "鸿蒙境", "鸿蒙皇境", "鸿蒙神境", "主宰境", "鸿蒙主宰", "混沌帝境", "混沌神境", "混沌主宰境", "F级", "E级", "D级", "C级", "B级", "A-级", "A级", "A+级", "S-级", "S级", "S+级", "SS-级", "SS级", "SS+级", "SSS-级", "SSS级", "SSS+级", "归元境", "魂海境", "法相境", "天王境", "天尊境", "天神境", "天帝境", "归一境", "无我境" };
string nu[] = { "半步", "一重", "二重", "三重", "四重", "五重", "六重", "七重", "八重", "九重", "巅峰" };
string pj[] = { "黄品", "玄品", "地品", "天品", "宗品", "王品", "皇品", "帝品", "圣品", "仙品", "神品" };
string c1[] = { "天", "地", "草", "鬼", "金", "木", "冰", "火", "雷", "光", "时", "空", "暗", "虚", "" };
string c2[] = { "灵", "神", "仙", "魔", "元", "明", "" };
string c3[] = { "兽", "龙", "凤", "凰", "猿", "蟒", "龟", "树", "花", "狼", "鹰", "草" };
string c4[] = { "混沌之", "空间之", "时间之", "时空之", "鸿蒙之", "维度之", "洪荒之", "虚空之", "暗影之", "因果之", "命运之", "生命之", "毁灭之" };
string c5[] = { "龙", "凤", "凰", "蛟", "龟", "树", "猿" };
string c6[] = { "龙", "凤", "龟", "猿" };
string c7[] = { "哮天犬", "啸月狼", "撼地猿", "银蛟", "仙鹤", "青牛", "振天虎", "行星哥斯拉", "红莲哥斯拉", "基多拉", "拉顿", "青龙", "白虎", "玄武", "朱雀", "黑龙", "饕餮", "鲲鹏", "恒星哥斯拉", "皮卡丘", "超梦", "赤炎龙", "凹凸曼", "奥特曼" };
string to[] = { "普通", "中级", "高级", "极品" };
long long int n, maxx, cnt;
long long int year;
long long int day;
int c[1001][1001]; // 0 表示 i 和 j 是陌生关系,1 表示 i 和 j 是友人关系...
node sear( int lq ) {
long long int a, b, c, d, e, f, t;
t = ( p[lq].xiu - 4 + rand() % 6 );
// t = p[lq].xiu - rand() % 4;
t = max( t, ( long long int )( 0 ) );
a = rand() % 15;
b = rand() % 7;
c = rand() % 12;
d = rand() % 13;
e = rand() % 7;
f = rand() % 4;
if ( c3[c] == "猿" && ( c1[a] == "草" || c1[a] == "光" || c1[a] == "木" ||
c1[a] == "金" || c1[a] == "冰" ) ) {
a = rand() % 15;
}
if ( c3[c] == "狼" && ( c1[a] == "草" || c1[a] == "地" || c1[a] == "木" ||
c1[a] == "金" || c1[a] == "冰" ) ) {
a = rand() % 15;
}
if ( c3[c] == "龟" && ( c1[a] == "空" || c1[a] == "天" || c1[a] == "金" ||
c1[a] == "木" || c1[a] == "水" ) ) {
a = rand() % 15;
}
if ( c3[c] == "猿" && ( c2[b] == "元" ) ) {
b = rand() % 7;
}
if ( ( c3[c] == "凤" || c3[c] == "凰" || c3[c] == "鹰" ) &&
( c1[a] == "地" || c1[a] == "木" || c1[a] == "金" || c1[a] == "时" ||
c1[a] == "空" ) ) {
a = rand() % 15;
}
if ( ( c3[c] == "龙" ) && ( c1[a] == "地" || c1[a] == "木" ||
c1[a] == "时" || c1[a] == "暗" || c1[a] == "光" ) ) {
a = rand() % 15;
}
string s = "";
if ( t <= 160 ) {
s += c1[a];
s += c2[b];
s += c3[c];
} else if ( t <= 400 ) {
s += c4[d];
s += c5[e];
} else {
long long int q = rand() % 10;
if ( q <= 6 ) {
s += c4[a];
s += "祖";
} else {
s += "祖";
s += c6[f];
}
}
if ( rand() % 50 == 0 ) {
s = c7[rand() % 24];
}
node q;
q.s = s;
q.t = t;
return q;
}
long long int random2( int x ) {
long long int return_LL = 0;
int t = 0;
while ( t < x ) {
long long int q = rand() % 16;
if ( q <= 6 ) {
return_LL = return_LL + ( long long int )( min( ( pow( 5, t / 11 + 1 ) * 1.10 ),
99000000 * 1.01 ) );
} else if ( q <= 10 ) {
return_LL = return_LL + ( long long int )( min( ( pow( 5, t / 11 + 1 ) * 1.10 ),
99000000 * 1.06 ) );
} else if ( q <= 13 ) {
return_LL = return_LL + ( long long int )( min( ( pow( 5, t / 11 + 1 ) * 1.10 ),
99000000 * 1.13 ) );
} else if ( q <= 15 ) {
return_LL = return_LL + ( long long int )( min( ( pow( 5, t / 11 + 1 ) * 1.10 ),
99000000 * 1.23 ) );
}
t++;
}
return return_LL;
}
void init() {
cout << "(主)角色人数:";
cin >> n;
cout << n << " 名(主)角色的姓名:" << endl;
for ( long long int i = 1; i <= n; i++ ) {
cout << i << ". ";
cin >> p[i].name;
p[i].ti = rand() + 1;
if ( p[i].name == "a" || rand() % 100 == 0 ) {
p[i].ti += rand() % 12000 + 8000;
}
p[i].xiu = ( p[i].ti / 1000 ) + 1;
p[i].att = random2( p[i].xiu );
p[i].zef = 1;
p[i].zef = p[i].zef + double( rand() % 50 ) / 100;
p[i].sho = rand() % 20 + 70 + p[i].xiu * 10;
p[i].alife = true;
}
system( "cls" );
for ( long long int i = 1; i <= n; i++ ) {
if ( p[i].xiu % 11 != 0 ) {
cout << i << ". [" << p[i].name << "] 境界:" << xw[p[i].xiu / 11] <<
nu[p[i].xiu % 11] << endl;
} else {
cout << i << ". " << p[i].name << "境界:" << nu[p[i].xiu % 11] <<
xw[p[i].xiu / 11] << endl;
}
cout << " 战力:" << p[i].att << endl;
cout << "天赋增幅:" << ( p[i].zef - 1 ) * 100 << "%" << endl << endl;
}
Sleep( sleep * n / 1.5 + 100 );
}
long long int random( int x ) {
long long int return_LL = 0;
double c = 1.00;
int t = 0;
while ( t < x ) {
if ( t % 11 == 0 ) {
long long int q = rand() % 13;
long long int er;
if ( q == 0 || q == 1 || q == 2 || q == 3 || q == 4 || q == 5 ) {
er = 0;
c = c * 1.05;
} else if ( q == 6 || q == 7 || q == 8 || q == 9 ) {
er = 1;
c = c * 1.10;
} else if ( q == 11 || q == 10 ) {
er = 2;
c = c * 1.25;
} else {
er = 3;
c = c * 1.45;
}
}
return_LL = return_LL + ( long long int )( min( ( pow( 5, t / 11 + 1 ) * c ),
99000000 * c ) );
// cout << " >>-战力:" << return_LL << " " << t << " 级" << " " << "增幅" << c << endl;
t++;
}
return 1;
// return return_LL;
}
int main() {
srand(time(0));
init();
// for( int i = 1; i <= 100; i++ )
// {
// node q = sear( 1 );
// cout << q.s << endl;
// }
cnt = n;
cout << n << " 个人穿越到了玄幻世界..." << endl;
Sleep(sleep * 2);
system("cls");
day = 0;
while ( cnt != 0 ) {
year = year + 1;
for ( long long int i = 1; i <= n; i++ ) {
if ( p[i].alife == false ) {
continue;
}
do {
if ( rand() % p[i].xiu / 1 >= 1 ) {
break;
}
if ( rand() % ( p[i].ti + p[i].xiu ) <= p[i].ti - min( p[i].xiu * 27,
( long long int )( 32700 ) ) || rand() * ( rand() % 80 ) != 1 ) {
cout << "第 " << year << " 年" << endl;
Sleep(sleep);
p[i].xiu++;
if ( p[i].xiu % 11 != 0 && p[i].xiu % 11 != 1 ) {
cout << p[i].name << "突破至 [" << xw[p[i].xiu / 11] << nu[p[i].xiu % 11] <<
"]" << endl;
} else if ( p[i].xiu % 11 == 0 ) {
cout << p[i].name << "突破至 [" << nu[p[i].xiu % 11] << xw[p[i].xiu / 11] <<
"]" << endl;
} else {
long long int q = rand() % 12;
long long int er;
if ( p[i].name == "a" ) {
er = rand() % 1 + 2;
if ( er == 3 ) {
p[i].zef = p[i].zef * 1.45;
} else {
p[i].zef = p[i].zef * 1.25;
}
} else if ( q == 0 || q == 1 || q == 2 || q == 3 || q == 4 || q == 5 ||
q == 6 ) {
er = 0;
p[i].zef = p[i].zef * 1.01;
} else if ( q == 5 || q == 6 || q == 7 || q == 8 ) {
er = 1;
p[i].zef = p[i].zef * 1.10;
} else if ( q == 9 || q == 10 ) {
er = 2;
p[i].zef = p[i].zef * 1.25;
} else if ( q == 11 ) {
er = 3;
p[i].zef = p[i].zef * 1.45;
}
cout << p[i].name << "使用" << to[er] << "突破丹突破至 [" << xw[p[i].xiu
/ 11] << nu[p[i].xiu % 11] << "]" << endl;
}
p[i].att = p[i].att + ( long long int )( min( ( pow( 5,
p[i].xiu / 11 + 1 ) * p[i].zef ), 99000000 * p[i].zef ) );
p[i].sho = p[i].sho + min( ( pow( 4, p[i].xiu / 11 ) * p[i].zef ),
8000000 * p[i].zef );
Sleep(sleep);
cout << "战力:" << p[i].att << endl;
cout << "寿命:" << p[i].sho << endl;
// cout << "天赋增幅:" << ( p[i].zef - 1 ) * 100 << "%" << endl;
cout << endl;
Sleep(sleep);
}
} while ( rand() % 50 == 0 );
if ( p[i].sho <= year ) {
// if( rand() % 10 == 1 )
if ( rand() % 10 >= 1 ) {
cout << "第 " << year << " 年" << endl;
Sleep(sleep);
p[i].xiu++;
if ( p[i].xiu % 11 != 0 && p[i].xiu % 11 != 1 ) {
cout << p[i].name << "寿元将尽时有感,突破至 [" << xw[p[i].xiu / 11]
<< nu[p[i].xiu % 11] << "]" << endl;
} else if ( p[i].xiu % 11 == 0 ) {
cout << p[i].name << "寿元将尽时有感,突破至 [" << nu[p[i].xiu % 11]
<< xw[p[i].xiu / 11] << "]" << endl;
} else {
long long int q = rand() % 12;
long long int er;
if ( p[i].name == "a" ) {
er = rand() % 1 + 2;
if ( er == 3 ) {
p[i].zef = p[i].zef * 1.45;
} else {
p[i].zef = p[i].zef * 1.25;
}
} else if ( q == 0 || q == 1 || q == 2 || q == 3 || q == 4 || q == 5 ||
q == 6 ) {
er = 0;
p[i].zef = p[i].zef * 1.01;
} else if ( q == 5 || q == 6 || q == 7 || q == 8 ) {
er = 1;
p[i].zef = p[i].zef * 1.10;
} else if ( q == 9 || q == 10 ) {
er = 2;
p[i].zef = p[i].zef * 1.25;
} else if ( q == 11 ) {
er = 3;
p[i].zef = p[i].zef * 1.45;
}
cout << p[i].name << "寿元将尽时有感,使用" << to[er] <<
"突破丹突破至 [" << xw[p[i].xiu / 11] << nu[p[i].xiu % 11] << "]" << endl;
}
p[i].att = p[i].att + ( long long int )( min( ( pow( 5,
p[i].xiu / 11 + 1 ) * p[i].zef ), 99000000 * p[i].zef ) );
p[i].sho = p[i].sho + min( ( pow( 4, p[i].xiu / 11 ) * p[i].zef ),
8000000 * p[i].zef );
Sleep(sleep);
cout << "战力:" << p[i].att << endl;
cout << "寿命:" << p[i].sho << endl;
// cout << "天赋增幅:" << ( p[i].zef - 1 ) * 100 << "%" << endl;
cout << endl;
Sleep(sleep * 2);
} else {
cout << "第 " << year << " 年" << endl;
cout << p[i].name << " 寿终而亡" << endl << endl;
cnt--;
p[i].alife = false;
Sleep(sleep * 2);
}
}
}
if ( rand() % 200 == 0 && cnt != 1 ) {
int a = 1;
int b = 2;
while ( b == a || p[a].alife != true || p[b].alife != true ) {
a = rand() % n + 1;
b = rand() % n + 1;
}
cout << "第 " << year << " 年" << endl;
cout << p[a].name << " 与 " << p[b].name << " 相遇了," << endl;
int qu = rand() % 11;
if ( ( qu < 6 || c[a][b] == 1 ) && c[a][b] != 2 ) {
cout << "他们相谈甚欢。" << endl << endl;
c[a][b] = 1;
} else if ( qu <= 8 ) {
cout << "他们打了起来,十分仇视对方。" << endl << endl;
c[a][b] = 2;
} else {
cout << "他们打了起来,";
if ( p[a].att > p[b].att ) {
cout << p[a].name << "打死了对方。" << endl << endl;
cnt--;
p[b].alife = false;
}
if ( p[a].att < p[b].att ) {
cout << p[b].name << "打死了对方。" << endl << endl;
cnt--;
p[a].alife = false;
}
if ( p[a].att == p[b].att ) {
cout << "他们打平了,但是互相仍然十分仇视。" << endl << endl;
c[a][b] = 2;
}
}
}
if ( rand() % 1000 == 0 ) {
int a;
do {
a = rand() % n + 1;
} while ( p[a].alife == false );
cout << "第 " << year << " 年" << endl;
cout << p[a].name << " 遇到了:" << endl;
node qr = sear( a );
if ( qr.t % 11 != 0 ) {
cout << " [" << xw[qr.t / 11] << nu[qr.t % 11] << "] " << qr.s << endl;
} else if ( qr.t % 11 == 0 ) {
cout << " [" << nu[qr.t % 11] << xw[qr.t / 11] << "]" << qr.s << endl;
}
long long int yz = random( qr.t );
cout << " 战力:" << yz << endl;
if ( yz > p[a].att ) {
if ( ( ( rand() % ( yz - p[a].att ) / 30 == 0 ) || rand() % 500 <= 0 ) &&
p[a].xiu >= 2 ) {
cout << p[a].name << " 侥幸逃脱" << endl;
int q = rand() % 3;
if ( q != 0 ) {
int X = p[a].xiu;
p[a].xiu = p[a].xiu - q;
cout << "境界下滑至 ";
if ( p[a].xiu % 11 != 0 ) {
cout << "[" << xw[p[a].xiu / 11] << nu[p[a].xiu % 11] << "]" << endl;
} else if ( p[a].xiu % 11 == 0 ) {
cout << "[" << nu[p[a].xiu % 11] << xw[p[a].xiu / 11] << "]" << endl;
}
for ( int i = 1; i <= q; i++ ) {
p[a].att = p[a].att - ( long long int )( min( ( pow( 5,
p[i].xiu / 11 + 1 ) * p[i].zef ), 99000000 * p[i].zef ) );
X--;
}
cout << "战力下滑至:" << p[a].att << endl;
} else {
cout << "。" << endl;
}
Sleep(sleep);
} else {
cout << p[a].name << " 陨落" << endl;
Sleep(sleep * 2);
p[a].alife = false;
cnt--;
}
} else if ( yz == p[a].att ) {
cout << "他们打平了。" << endl;
Sleep(sleep);
} else {
cout << p[a].name << ">> 得胜。" << endl;
Sleep(sleep);
}
cout << endl;
}
}
Sleep(sleep * 5);
cout << "本次模拟结束,最高境界为:";
long long int maxx = 0;
for ( long long int i = 1; i <= n; i++ ) {
maxx = max( maxx, p[i].xiu );
}
if ( maxx % 11 != 0 ) {
cout << xw[maxx / 11] << nu[maxx % 11] << endl;
} else {
cout << nu[maxx % 11] << xw[maxx / 11] << endl;
}
return 0;
}
/*
6
林天
陈凡
林凡
萧凡
顾天行
白芸
*/