https://play.xiangqi.com/lessons java ddd
1012208022
#include<bits/stdc++.h>
#include<conio.h>
#include<windows.h>
#define qp system("cls")
using namespace std;
string dt[100]= {
"##################################################",
"# &&# #",
"#&#&# #",
"#&#$# #",
"#&### ############# #",
"# #$ $&$ # #",
"# # # # #",
"# ###&######&&# #",
"# # $# # #",
"# #|##### # #",
"# # &# #&### #",
"# # & # $# #",
"# ######&&##### #",
"# #$ # #",
"# # # #",
"# ##&&## #",
"# #",
"# ############# #",
"# #$#^^^ #&$ $# ##############&#",
"# # # & # #$ &$ # #",
"# ###&#&&&##&&# # # # #",
"# # $& #############&######&&#$ #",
"# #|##### # $# # #",
"# # &# #&#############&#####& # $#",
"# # & # $# # &# #&### #",
"# & ####&&##&## # & # $#$ #",
"# # # # ######&&########",
"# #$ $&$ $# #$ # #",
"# # & # # # #",
"# ###&#&#&##&&# ##&&## #",
"# # $& & #",
"# #|##### # #",
"# # &# #&### #",
"# # & # $# #",
"# ######&&##### #",
"# #",
"# #",
"# #",
"# ################## #",
"# #$ $&$ #$ # #",
"# # # # # ######",
"# ###&######&&##&### & $#",
"# # $# & &$# ######",
"# #|##### ###### #",
"# # &# #&### #",
"# # & # $# #",
"# ######&&##### #",
"# #$ # #",
"# # # #",
"# ##&&## #",
"# #",
"# #",
"# #",
"# #",
"# ################## #",
"# #$ $&$ #$ # #",
"# # # # # #",
"# ###&######&&##&### #",
"# # $# & &$# #",
"# #|##### ###### #",
"# # &# #&### #",
"# # & # $# #",
"# ######&&##### #",
"# #$ # #",
"# # # #",
"# ##&&## #",
"# #",
"# #",
"# #",
"# #",
"# ################## #",
"# #$ $&$ #$ # #",
"# # # # # #",
"# ###&######&&##&### #",
"# # $# & &$# #",
"# #|##### ###### #",
"# # &# #&### #",
"# # & # $# #",
"# ######&&##### #",
"# #$ # #",
"# # # #",
"# ##&&## #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^#",
"##################################################"
};
int rand_10000(){
int a=1;
for(int i=0;i<4;i++){
a*=(rand()%10+1);
}
return a;
}
void sl(long long it) {
Sleep(it);
}
void out(string s) {
for(int i=0; i<s.size(); i++) {
printf("%c",s[i]);
sl(50);
}
}
char get() {
if(kbhit()) {
char now_ch_in;
now_ch_in=getch();
return now_ch_in;
}
return char(0);
}
struct things {
string name;
long long m;
long long g;
short gl;
// things(){}
// things(string w1,long long w2,long long w3){
// name=w1;
// m=w2;
// g=w3;
// }
};
things th[35];
void things_start() {
th[0]= {"机密文件",7000000,2,1};
th[1]= {"理想国",4000000,6,3};
th[2]= {"热成像模块",800000,2,10};
th[3]= {"花瓶",350000,4,20};
th[4]= {"茶壶",400000,4,20};
th[5]= {"金狮",400000,6,20};
th[6]= {"盛宴雕塑",400000,6,40};
th[7]= {"宝石项链",350000,4,40};
th[8]= {"金块",100000,2,100};
th[9]= {"钛合金版",60000,6,200};
th[10]= {"装饰手杖",40000,4,100};
th[11]= {"金魔方",60000,1,200};
th[12]= {"金手表",20000,1,200};
th[13]= {"金手机",20000,1,300};
th[14]= {"伞绳",10000,4,1000};
th[15]= {"千斤顶",6000,2,500};
th[16]= {"宫廷银器",8000,400};
th[17]= {"水泥",8000,4,400};
th[18]= {"一袋种子",7000,4,400};
th[19]= {"石膏雕塑",8000,6,400};
th[20]= {"测距望远镜",6000,2,500};
th[21]= {"座钟",7000,4,400};
th[22]= {"vego数据连接线",2000,200};
th[23]= {"橡木板",4000,2,500};
th[24]= {"军用水壶",2000,2,500};
th[25]= {"CPU",1000,1,396};
th[26]= {"老式散热器",100,1,350};
th[27]= {"破损的屏幕",1000,2,350};
th[28]= {"手机",2000,1,350};
th[29]= {"打火机",900,1,350};
th[30]= {"杀虫剂",2000,3,350};
th[31]= {"老虎钳",900,1,350};
th[32]= {"U盘",500,1,350};
th[33]= {"一盒钉子",300,1,350};
th[34]= {"扳手",400,1,350};
}
struct things_2{
string name;
long long m;
long long g;
long long n;
things_2(){}
things_2(things e){
name=e.name;
m=e.m;
g=e.m;
n=0;
}
};
things_2 bag[35];
void new_bag(){
for(int i=0;i<35;i++){
things_2 r(th[i]);
bag[i].name=r.name;
bag[i].n=r.n;
bag[i].g=r.g;
bag[i].m=r.m;
}
}
int thing_s() {
int l=rand_10000();
int y=0;
for(int i=0; i<35; i++) {
y+=th[i].gl;
if(l<=y){
cout<<th[i].name<<endl;
return i;
}
}
}
bool choice() {
string ll;
getline(cin,ll);
if(ll=="1") {
return false;
} else if(ll=="2") {
return true;
} else return choice();
}
int ax=1,ay=1;
void out() {
for(int i=ax-10; i<ax+10; i++) {
for(int j=ay-10; j<ay+10; j++) {
if(i<0||j<0)printf(" ");
else if(i>=100||j>=100)printf(" ");
else {
if(i==ax&&j==ay) {
printf("a");
} else {
printf("%c",dt[i][j]);
}
}
}
cout<<"\n";
}
}
void out_bag(){
qp;
for(int i=0;i<35;i++){
if(bag[i].n!=0){
printf("%s\n%lld %lld x%lld\n",bag[i].name.c_str(),bag[i].m,bag[i].g,bag[i].n);
}
}
}
bool door_open() {
if(dt[ax+1][ay]=='&'||dt[ax-1][ay]=='&'||dt[ax][ay+1]=='&'||dt[ax][ay+1]=='&')return true;
return false;
}
bool door_close() {
if(dt[ax+1][ay]=='|'||dt[ax-1][ay]=='|'||dt[ax][ay+1]=='|'||dt[ax][ay+1]=='|')return true;
return false;
}
int cl=0;
bool cl_v=false;
void thing_into_bag(){
int tn=rand()%10+2;
things ts[tn];
for(int i=0;i<tn;i++){
ts[i]=th[thing_s()];
}
}
void game() {
new_bag();
while(1) {
int c=get();
char k=c;
bool flag=false;
if(k=='a') {
if(ay>1&&dt[ax][ay-1]!='#'&&dt[ax][ay-1]!='&')ay--;
flag=true;
} else if(k=='d'&&dt[ax][ay+1]!='#'&&dt[ax][ay+1]!='&') {
if(ay<100)ay++;
flag=true;
} else if(k=='w'&&dt[ax-1][ay]!='#'&&dt[ax-1][ay]!='&') {
if(ax>1)ax--;
flag=true;
} else if(k=='s'&&dt[ax+1][ay]!='#'&&dt[ax+1][ay]!='&') {
if(ax<100)ax++;
flag=true;
} else if(k=='f'&&door_open()) {
if(dt[ax+1][ay]=='&')dt[ax+1][ay]='|';
if(dt[ax-1][ay]=='&')dt[ax-1][ay]='|';
if(dt[ax][ay+1]=='&')dt[ax][ay+1]='|';
if(dt[ax][ay-1]=='&')dt[ax][ay-1]='|';
flag=true;
} else if(k=='g'&&door_close()) {
if(dt[ax+1][ay]=='|')dt[ax+1][ay]='&';
if(dt[ax-1][ay]=='|')dt[ax-1][ay]='&';
if(dt[ax][ay+1]=='|')dt[ax][ay+1]='&';
if(dt[ax][ay-1]=='|')dt[ax][ay-1]='&';
flag=true;
} else if(k=='r'&&dt[ax][ay]=='$') {
} else if(k=='e') {
out_bag();
}
if(flag) {
system("cls");
out();
}
if(cl_v) {
if(dt[ax][ay]=='^')cl++,qp,out(),cout<<cl/10.0;
else cl_v=false;
if(cl==30)return;
}
if(dt[ax][ay]=='^')cl_v=true;
sl(10);
}
}
void main_() {
out("Welcome to ***\n");
sl(500);
out("1.仓库\n2.出发");
if(!choice()) {
} else {
game();
}
}
int main() {
srand(time(0));
things_start();
main_();
}