#include <bits/stdc++.h>
#include <iostream>
#include <windows.h>
#include <conio.h>
#include <ctime>
#include <string>
#include <fstream>
#include <stdlib.h>
using namespace std;
//stuct----------
struct xy
{
int x;
int y;
};
struct _map
{
xy wj1,wj2;
int wx1,wx2;
bool j1,j2;
int zd1,zd2;
int q1,q2;
int tl1,tl2;
bool wall[15][15];
bool lz[15][15];
};
_map _map;
clock_t ccc1,ccc2;
int cht;
xy hp;
void SetPos(COORD a);
void SetPos(int i, int j);
void HideCursor();
void row(int y, int x1, int x2, char ch);
void col(int x, int y1, int y2, char ch);
void copy2(bool *a,bool *b,int x,int y);
void start_1();
void END();
void fuzhi(const int mapm);
void print_plate(const int mapm);
void movep(xy a,int wj);
void fxy(int x,int y,xy &c);
void shuaqian();
void play();
void guize();
void SetColor(int ForgC, int BackC);
int main()
{
start_1();
cout<<"1.开始游戏"<<endl<<"2.查看规则" ;
int sssss;
while(1){
sssss=_getch();
if(sssss=='1' || sssss=='2'){
break;
}
if(sssss==27){
exit(0);
}
}
sssss-='1';
if(!sssss){
while(1){
play();
}
}
if(sssss){
guize();
while(1){
play();
}
}
}
void guize(){
system("cls");
system("mode con cols=69 lines=55");
cout<<"1.栏"<<endl;
cout<<""<<endl;
cout<<" =================================================================="<<endl;
cout<<" |■■■■■■■■■■■■■■■| 玩家1: ||||||||||||||"<<endl;
cout<<" |■w2/*玩家2*/ ■| 100$ ||||||||||||||"<<endl;
cout<<" |■ ■| 0zd ||||||||||||||"<<endl;
cout<<" |■ ■| 100x ||||||||||||||"<<endl;
cout<<" |■ ■| ||||||||||||||"<<endl;
cout<<" |■ ■| tl:200 ||||||||||||||"<<endl;
cout<<" |■ ■| ||||||||||||||"<<endl;
cout<<" |■ ■|--------------------||||||||||||||"<<endl;
cout<<" |■ ■| 玩家2: ||||||||||||||"<<endl;
cout<<" |■ ■| 100$ /*剩余钱数*/|||||||||||||"<<endl;
cout<<" |■ ■| 0zd /*剩余子弹数*/||||||||||||"<<endl;
cout<<" |■ ■| 100x /*剩余血量*/|||||||||||||"<<endl;
cout<<" |■ ■| ||||||||||||||"<<endl;
cout<<" |■w1 /*玩家1*/ ■| tl:200 /*体力*/ ||||||||||||||"<<endl;
cout<<" |■■■■■■■■■■■■■■■| ||||||||||||||"<<endl;
cout<<" =================================================================="<<endl;
cout<<"2.控制"<<endl;
cout<<""<<endl;
cout<<" 玩家1:"<<endl;
cout<<" q/*买并使用药*/ w/*使用或购买刀*/ e/*购买子弹*/ r/*破墙*/"<<endl;
cout<<""<<endl;
cout<<" s/*前进*/ d/*发射子弹*/"<<endl;
cout<<""<<endl;
cout<<" z/*向左*/ x/*后退*/ c/*向右*/"<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<" 玩家2:"<<endl;
cout<<" 7/*买并使用药*/ 8/*使用或购买刀*/ 9/*购买子弹*/ +/*破墙*/"<<endl;
cout<<""<<endl;
cout<<" 5/*前进*/ 6/*发射子弹*/"<<endl;
cout<<""<<endl;
cout<<" 1/*向左*/ 2/*后退*/ 3/*向右*/"<<endl;
cout<<""<<endl;
cout<<"3.开始游戏"<<endl;
cout<<""<<endl;
cout<<" 每回玩家体力+1,玩家的钱 33.33% 可能性+3"<<endl;
cout<<""<<endl;
cout<<" 子弹打一下1滴血,消耗3个体力,攻击范围6,子弹20$5个;"<<endl;
cout<<""<<endl;
cout<<" 刀砍一下7滴血,消耗25个体力,攻击范围1。"<<endl;
cout<<""<<endl;
cout<<" 药30$,恢复25滴血,100体力"<<endl;
cout<<"______________________"<<endl;
cout<<"按任意键开始游戏...";
_getch();
system("cls");
}
void play(){
system("cls");
int state;
cout<<"选择地图:"<<endl;
cout<<"0.平坦 1简单 2.复杂 3.随机" ;
while(1){
state=_getch()-48 ;
if(state>=0 && state<=3)
break;
}
system("cls");
cout<<"loading";
if(state==3){
state=rand()%3;
}
cout<<".";
system("mode con cols=67 lines=21");
fuzhi(state);
cout<<".";
fxy(1,1,_map.wj1);
fxy(13,1,_map.wj2);
_map.wx1=300;_map.wx2=300;
cout<<".";
_map.j1=0;_map.j2=0;
_map.zd1=0;_map.zd2=0;
_map.q1=100;_map.q2=100;
_map.tl1=100;_map.tl2=100;
system("cls");
print_plate(state);
movep(_map.wj1,1);
movep(_map.wj2,2);
while(1){
cht=getch();
switch(cht){
//---wj2
case 53: //2 上
hp=_map.wj2;
hp.x--;
if(_map.wall[hp.x][hp.y])
break;
if(_map.wj1.y==hp.y && _map.wj1.x==hp.x)
break;
movep(hp,2);
_map.wj2.x--;
break;
case 50: //2 下
hp=_map.wj2;
hp.x++;
if(_map.wall[hp.x][hp.y])
break;
if(_map.wj1.y==hp.y && _map.wj1.x==hp.x)
break;
movep(hp,2);
_map.wj2.x++;
break;
case 49: //2 左
hp=_map.wj2;
hp.y--;
if(_map.wall[hp.x][hp.y])
break;
if(_map.wj1.y==hp.y && _map.wj1.x==hp.x)
break;
movep(hp,2);
_map.wj2.y--;
break;
case 51: //2 右
hp=_map.wj2;
hp.y++;
if(_map.wall[hp.x][hp.y])
break;
if(_map.wj1.y==hp.y && _map.wj1.x==hp.x)
break;
movep(hp,2);
_map.wj2.y++;
break;
case 57: //购买子弹
if(_map.q2<20)
break;
_map.q2-=20;
_map.zd2+=5;
SetPos(36,10);
cout<<_map.q2<<"$ ";
SetPos(36,11);
cout<<_map.zd2<<"zd ";
break;
case 54: //使用子弹
if(_map.tl2<3)
break;
if(abs(_map.wj2.x-_map.wj1.x)>6 || abs(_map.wj2.y-_map.wj1.y)>6)
break;
if(_map.zd2<1)
break;
_map.zd2--;
_map.wx1-=2;
_map.tl2-=3;
SetPos(36,11);
cout<<_map.zd2<<"zd ";
SetPos(36,4);
cout<<_map.wx1<<"x ";
SetPos(36,14);
cout<<_map.tl2;
break;
case 56: //使用 / 购买 剑
if(!_map.j2){
if(_map.q2<50)
break;
_map.q2-=50;
_map.j2=1;
}
if(_map.tl2<25)
break;
if(abs(_map.wj2.x-_map.wj1.x)>1 || abs(_map.wj2.y-_map.wj1.y)>1)
break;
_map.wx1-=15;
_map.tl2-=25;
SetPos(36,4);
cout<<_map.wx1<<"x ";
SetPos(36,14);
cout<<_map.tl2<<" ";
break;
case 55: //使用药
if(_map.q2<30){
break;
}
_map.q2-=30;
_map.wx2+=25;
_map.tl2+=100;
SetPos(36,11);
cout<<_map.q2<<"$ ";
SetPos(36,12);
cout<<_map.wx2<<"x ";
SetPos(36,14);
cout<<_map.tl2<<" ";
case 43:
if(_map.tl2<180){
break ;
}
_map.tl2-=180;
if(_map.wj2.x+1!=14)
_map.wall[_map.wj2.x+1][_map.wj2.y]=0;
if(_map.wj2.y+1!=14)
_map.wall[_map.wj2.x][_map.wj2.y+1]=0;
if(_map.wj2.x-1!=0)
_map.wall[_map.wj2.x-1][_map.wj2.y]=0;
if(_map.wj2.y-1!=0)
_map.wall[_map.wj2.x][_map.wj2.y-1]=0;
break;
//---wj1
case 115: //1 上
hp=_map.wj1;
hp.x--;
if(_map.wall[hp.x][hp.y])
break;
if(_map.wj2.y==hp.y && _map.wj2.x==hp.x)
break;
movep(hp,1);
_map.wj1.x--;
break;
case 120: //1 下
hp=_map.wj1;
hp.x++;
if(_map.wall[hp.x][hp.y])
break;
if(_map.wj2.y==hp.y && _map.wj2.x==hp.x)
break;
movep(hp,1);
_map.wj1.x++;
break;
case 122: //1 左
hp=_map.wj1;
hp.y--;
if(_map.wall[hp.x][hp.y])
break;
if(_map.wj2.y==hp.y && _map.wj2.x==hp.x)
break;
movep(hp,1);
_map.wj1.y--;
break;
case 99: //1 右
hp=_map.wj1;
hp.y++;
if(_map.wall[hp.x][hp.y])
break;
if(_map.wj2.y==hp.y && _map.wj2.x==hp.x)
break;
movep(hp,1);
_map.wj1.y++;
break;
case 101: //购买子弹
if(_map.q1<20)
break;
_map.q1-=20;
_map.zd1+=5;
SetPos(36,2);
cout<<_map.q1<<"$ ";
SetPos(36,3);
cout<<_map.zd1<<"zd ";
break;
case 100: //使用子弹
if(_map.tl1<3)
break;
if(abs(_map.wj1.x-_map.wj2.x)>6 || abs(_map.wj1.y-_map.wj2.y)>6)
break;
if(_map.zd1<1)
break;
_map.zd1--;
_map.wx2-=2;
_map.tl1-=3;
SetPos(36,3);
cout<<_map.zd1<<"zd ";
SetPos(36,12);
cout<<_map.wx2<<"x ";
SetPos(36,14);
cout<<_map.tl1;
break;
case 119: //使用 / 购买 剑
if(!_map.j1){
if(_map.q1<50)
break;
_map.q1-=50;
_map.j1=1;
}
if(_map.tl1<25)
break;
if(abs(_map.wj1.x-_map.wj2.x)>1 || abs(_map.wj1.y-_map.wj2.y)>1)
break;
_map.wx2-=15;
_map.tl1-=25;
SetPos(36,12);
cout<<_map.wx2<<"x ";
SetPos(36,6);
cout<<_map.tl1<<" ";
break;
case 113: //使用药
if(_map.q1<30){
break;
}
_map.q1-=15;
_map.wx1+=10;
_map.tl1+=100;
SetPos(36,3);
cout<<_map.q1<<"$ ";
SetPos(36,4);
cout<<_map.wx1<<"x ";
SetPos(36,6);
cout<<_map.tl2<<" ";
break;
case 114:
if(_map.tl1<180){
break ;
}
_map.tl1-=180;
if(_map.wj1.x+1!=14)
_map.wall[_map.wj1.x+1][_map.wj1.y]=0;
if(_map.wj1.y+1!=14)
_map.wall[_map.wj1.x][_map.wj1.y+1]=0;
if(_map.wj1.x-1!=0)
_map.wall[_map.wj1.x-1][_map.wj1.y]=0;
if(_map.wj1.y-1!=0)
_map.wall[_map.wj1.x][_map.wj1.y-1]=0;
break;
}
shuaqian();
_map.tl1+=2;
_map.tl2+=2;
SetPos(36,14);
cout<<_map.tl2;
SetPos(36,6);
cout<<_map.tl1;
if(_map.wx2<0){
system("cls");
cout<<"玩家1胜";
cout<<endl<<"继续?y/n";
char ccc;
while(1){
ccc=_getch();
if(ccc==121){
return ;
}
if(ccc==110){
exit(0);
}
}
}
if(_map.wx1<0){
system("cls");
cout<<"玩家2胜";
cout<<endl<<"继续?y/n";
char ccc;
while(1){
ccc=_getch();
if(ccc==121){
return ;
}
if(ccc==110){
exit(0);
}
}
}
}
}
void SetPos(COORD a)// set cursor
{
HANDLE out=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(out, a);
}
void SetPos(int i, int j)// set cursor
{
COORD pos={i, j};
SetPos(pos);
}
void HideCursor()
{
CONSOLE_CURSOR_INFO cursor_info = {1, 0};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
}
void row(int y, int x1, int x2, char ch)
{
SetPos(x1,y);
for(int i = 0; i <= (x2-x1); i++)
cout<<ch;
}
void col(int x, int y1, int y2, char ch)
{
int y=y1;
while(y!=y2+1)
{
SetPos(x, y);
cout<<ch;
y++;
}
}
void copy2(bool *a,bool *b,int x,int y)
{
for(int A=0;A<x*y;A++){
*b=*a;
b++;a++;
}
return ;
}
void SetColor(int ForgC, int BackC) {
WORD wColor = ((BackC & 0x0F) << 4) + (ForgC & 0x0F);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), wColor);
}
void start_1()
{
system("mode con cols=67 lines=21");
system("color 1B");
cout<<"________________________________"<<endl;
cout<<"|##############################|"<<endl;
cout<<"|####### ########|"<<endl;
cout<<"|##############################|"<<endl;
string title_=" z s 游戏(双人)";
Sleep(200);
SetPos(7,2);
for(int A=0;A<title_.length();A++){
cout<<title_[A];
Sleep(50);
}
HideCursor();
Sleep(500);
system("cls");
bool sd[9][11]=
{
{0,1,1,1,0,0,1,1,1,0,0},
{1,0,0,0,1,0,1,0,0,1,0},
{1,0,0,0,0,0,1,0,0,0,1},
{1,0,0,0,0,0,1,0,0,0,1},
{0,1,1,1,0,0,1,0,0,0,1},
{0,0,0,0,1,0,1,0,0,0,1},
{0,0,0,0,1,0,1,0,0,0,1},
{1,0,0,0,1,0,1,0,0,1,0},
{0,1,1,1,0,0,1,1,1,0,0}
};
for(int A=0;A<9;A++){
for(int B=0;B<11;B++){
if(B<6){
SetColor(2,1);
}
else {
SetColor(4,1);
}
if(sd[A][B]){
cout<<"■";
}
else {
cout<<" ";
}
}
cout<<endl;
Sleep(40);
}
Sleep(1000);
SetConsoleTitle("sd 3.1");
system("cls");
srand((int)time(0));
SetColor(12,1);
cout<<"■■■ ■"<<endl;
cout<<" ■ ■"<<endl;
cout<<"■■■ ■"<<endl;
cout<<" ■ ■"<<endl;
cout<<"■■■ ■ ■"<<endl;
Sleep(1000);
ccc1=clock();
system("mode con cols=67 lines=21");
system("cls");
system("color 1B");
}
void END()
{
SetPos(0,19);
cout<<endl<<"--------------------------------";
cout<<endl<<"Process exited after ";
ccc2=clock();
cout<<(double(ccc2)-double(ccc1))/1000;
cout<<" seconds with return value 0";
cout<<endl<<"请按任意键继续...";
getch();
exit(0);
}
void fuzhi(const int mapm)
{
if(mapm==0){
bool a[15][15]={
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},//0
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},//1
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},//2
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},//3
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},//4
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},//5
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},//6
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},//7
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},//8
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},//9
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},//10
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},//11
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},//12
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},//13
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} //14
//end
};
copy2(&a[0][0],&_map.wall[0][0],15,15);
}
else if(mapm==1){
bool a[15][15]={
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},//0
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},//1
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},//2
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},//3
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},//4
{1,0,1,1,1,0,0,0,0,0,0,0,0,0,1},//5
{1,0,0,0,1,0,0,0,0,0,1,0,1,0,1},//6
{1,1,1,0,1,1,1,1,1,1,1,0,1,1,1},//7
{1,0,1,0,1,0,0,0,0,0,1,0,0,0,1},//8
{1,0,0,0,0,0,0,0,0,0,1,1,1,0,1},//9
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},//10
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},//11
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},//12
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},//13
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} //14
//end
};
copy2(&a[0][0],&_map.wall[0][0],15,15);
}
else if(mapm==2){
bool a[15][15]={
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},//0
{1,0,0,1,0,0,0,1,0,0,0,0,0,0,1},//1
{1,0,0,0,0,1,0,1,0,1,1,1,1,0,1},//2
{1,0,1,1,1,1,1,1,0,1,0,0,1,0,1},//3
{1,0,0,0,0,0,0,1,0,1,0,1,1,0,1},//4
{1,0,1,0,1,0,1,1,0,1,0,0,0,0,1},//5
{1,0,1,0,1,0,0,0,0,1,1,1,1,0,1},//6
{1,1,1,0,1,1,1,1,1,1,0,0,1,1,1},//7
{1,0,1,0,1,0,0,0,0,1,1,0,0,0,1},//8
{1,0,0,0,0,0,0,1,0,0,1,1,1,0,1},//9
{1,1,1,1,1,1,0,1,1,0,1,0,1,0,1},//10
{1,0,0,0,0,1,0,0,1,0,0,0,0,0,1},//11
{1,0,1,1,1,1,0,0,1,1,1,1,1,0,1},//12
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},//13
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} //14
//end
};
copy2(&a[0][0],&_map.wall[0][0],15,15);
}
return ;
}
void print_plate(const int mapm){
if(mapm==0){
// 0 1 2 3 4 5
// 1 3 5 7 9 1 3 5 7 9 1 3 5 7 9 1 3 5 7 9 1 3 5 7 9 1 3 5 7 9
cout<<"=================================================================="<<endl;//0
cout<<"|■■■■■■■■■■■■■■■| 玩家1: ||||||||||||||"<<endl;//1
cout<<"|■ ■| 100$ ||||||||||||||"<<endl;//2
cout<<"|■ ■| 0zd ||||||||||||||"<<endl;//3
cout<<"|■ ■| 300x ||||||||||||||"<<endl;//4
cout<<"|■ ■| ||||||||||||||"<<endl;//5
cout<<"|■ ■| tl:200 ||||||||||||||"<<endl;//6
cout<<"|■ ■| ||||||||||||||"<<endl;//7
cout<<"|■ ■|--------------------||||||||||||||"<<endl;//8
cout<<"|■ ■| 玩家2: ||||||||||||||"<<endl;//9
cout<<"|■ ■| 100$ ||||||||||||||"<<endl;//10
cout<<"|■ ■| 0zd ||||||||||||||"<<endl;//11
cout<<"|■ ■| 300x ||||||||||||||"<<endl;//12
cout<<"|■ ■| ||||||||||||||"<<endl;//13
cout<<"|■ ■| tl:100 ||||||||||||||"<<endl;//14
cout<<"|■■■■■■■■■■■■■■■| ||||||||||||||"<<endl;//15
cout<<"=================================================================="<<endl;//16
}
if(mapm==1){
// 0 1 2 3 4 5
// 1 3 5 7 9 1 3 5 7 9 1 3 5 7 9 1 3 5 7 9 1 3 5 7 9 1 3 5 7 9
cout<<"=================================================================="<<endl;//0
cout<<"|■■■■■■■■■■■■■■■| 玩家1: ||||||||||||||"<<endl;//1
cout<<"|■ ■| 100$ ||||||||||||||"<<endl;//2
cout<<"|■ ■| 0zd ||||||||||||||"<<endl;//3
cout<<"|■ ■| 300x ||||||||||||||"<<endl;//4
cout<<"|■ ■| ||||||||||||||"<<endl;//5
cout<<"|■ ■■■ ■| tl:200 ||||||||||||||"<<endl;//6
cout<<"|■ ■ ■ ■ ■| ||||||||||||||"<<endl;//7
cout<<"|■■■ ■■■■■■■ ■■■|--------------------||||||||||||||"<<endl;//8
cout<<"|■ ■ ■ ■ ■| 玩家2: ||||||||||||||"<<endl;//9
cout<<"|■ ■■■ ■| 100$ ||||||||||||||"<<endl;//10
cout<<"|■ ■| 0zd ||||||||||||||"<<endl;//11
cout<<"|■ ■| 300x ||||||||||||||"<<endl;//12
cout<<"|■ ■| ||||||||||||||"<<endl;//13
cout<<"|■ ■| tl:100 ||||||||||||||"<<endl;//14
cout<<"|■■■■■■■■■■■■■■■| ||||||||||||||"<<endl;//15
cout<<"=================================================================="<<endl;//16
}
if(mapm==2){
// 0 1 2 3 4 5
// 1 3 5 7 9 1 3 5 7 9 1 3 5 7 9 1 3 5 7 9 1 3 5 7 9 1 3 5 7 9
cout<<"=================================================================="<<endl;//0
cout<<"|■■■■■■■■■■■■■■■| 玩家1: ||||||||||||||"<<endl;//1
cout<<"|■ ■ ■ ■| 100$ ||||||||||||||"<<endl;//2
cout<<"|■ ■ ■ ■■■■ ■| 0zd ||||||||||||||"<<endl;//3
cout<<"|■ ■■■■■■ ■ ■ ■| 300x ||||||||||||||"<<endl;//4
cout<<"|■ ■ ■ ■■ ■| ||||||||||||||"<<endl;//5
cout<<"|■ ■ ■ ■■ ■ ■| tl:200 ||||||||||||||"<<endl;//6
cout<<"|■ ■ ■ ■■■■ ■| ||||||||||||||"<<endl;//7
cout<<"|■■■ ■■■■■■ ■■■|--------------------||||||||||||||"<<endl;//8
cout<<"|■ ■ ■ ■■ ■| 玩家2: ||||||||||||||"<<endl;//9
cout<<"|■ ■ ■■■ ■| 100$ ||||||||||||||"<<endl;//10
cout<<"|■■■■■■ ■■ ■ ■ ■| 0zd ||||||||||||||"<<endl;//11
cout<<"|■ ■ ■ ■| 300x ||||||||||||||"<<endl;//12
cout<<"|■ ■■■■ ■■■■■ ■| ||||||||||||||"<<endl;//13
cout<<"|■ ■| tl:100 ||||||||||||||"<<endl;//14
cout<<"|■■■■■■■■■■■■■■■| ||||||||||||||"<<endl;//15
cout<<"=================================================================="<<endl;//16
}
return ;
}
void movep(xy a,int wj)
{
if(wj==1)
{
SetPos(_map.wj1.y*2+1,_map.wj1.x+1);
cout<<" ";
SetPos(a.y*2+1,a.x+1);
cout<<"w1";
}
else {
SetPos(_map.wj2.y*2+1,_map.wj2.x+1);
cout<<" ";
SetPos(a.y*2+1,a.x+1);
cout<<"w2";
}
}
void fxy(int x,int y,xy &c)
{
c.x=x;
c.y=y;
return ;
}
void shuaqian(){
if(rand()%3==0){
_map.q1+=3;
}
SetPos(36,2);
cout<<_map.q1<<"$ ";
if(rand()%3==0){
_map.q2+=3;
}
SetPos(36,10);
cout<<_map.q2<<"$ ";
return ;
}
|