|
|
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1>Ϸ
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include<windows.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include<conio.h> //ʹ<><CAB9>getch()<29><><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
int startchoice,winner,player,Q[200][200]= {0}; //Q<><51><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
|
|
|
|
|
char button; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EEA3AC><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
struct Point //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľṹ<C4BD><E1B9B9>
|
|
|
|
|
{
|
|
|
|
|
int x,y;
|
|
|
|
|
} point,game_xy;
|
|
|
|
|
|
|
|
|
|
struct Piece //<2F><><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼
|
|
|
|
|
{
|
|
|
|
|
struct Point coord;
|
|
|
|
|
struct Piece *fore;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct Piece *head,*p,*ptr,*ptr1;
|
|
|
|
|
|
|
|
|
|
void goto_xy(int x, int y) //<2F><><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
COORD c;
|
|
|
|
|
c.X=2*x;
|
|
|
|
|
c.Y=y;
|
|
|
|
|
SetConsoleCursorPosition (GetStdHandle(STD_OUTPUT_HANDLE), c);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Init() //<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
|
|
|
|
{
|
|
|
|
|
for(int i=0; i<200; i++)
|
|
|
|
|
for(int j=0; j<200; j++)
|
|
|
|
|
Q[i][j]=0;
|
|
|
|
|
|
|
|
|
|
startchoice=0;
|
|
|
|
|
player=1;
|
|
|
|
|
p=(struct Piece *)malloc(sizeof(struct Piece));
|
|
|
|
|
head=p;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Welcome() //<2F><>ӭ<EFBFBD><D3AD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
system("color B0"); //#include<windows.h> B <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>dz<EFBFBD><C7B3>ɫ 0 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
|
|
|
|
|
goto_xy(10,3);
|
|
|
|
|
printf("-<2D><>");
|
|
|
|
|
goto_xy(17,1);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>");
|
|
|
|
|
goto_xy(13,3);
|
|
|
|
|
printf(" ***<2A><><EFBFBD>˶<EFBFBD>ս***");
|
|
|
|
|
goto_xy(13,4);
|
|
|
|
|
printf(" ***<2A>˳<EFBFBD>***");
|
|
|
|
|
point.x=12;
|
|
|
|
|
point.y=3;
|
|
|
|
|
goto_xy(0,0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ShowWho() //<2F><>ʾ<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
goto_xy(17,24);
|
|
|
|
|
if(player==0)
|
|
|
|
|
printf("<EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
else
|
|
|
|
|
printf("<EFBFBD>ֵ<EFBFBD><EFBFBD>ҷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
goto_xy(point.x,point.y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Draw() //<2F>滭<EFBFBD><E6BBAD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
game_xy.x=10;
|
|
|
|
|
game_xy.y=3;
|
|
|
|
|
system("cls");
|
|
|
|
|
system("color 3F"); //3 <20><><EFBFBD><EFBFBD>ɫ F <20><><EFBFBD><EFBFBD>ɫ
|
|
|
|
|
goto_xy(15,1);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ӭplay our <20><><EFBFBD><EFBFBD><EFBFBD>壡");
|
|
|
|
|
/*goto_xy(29,22);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>¿<EFBFBD>ʼ r");*/
|
|
|
|
|
goto_xy(1,24);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> b");
|
|
|
|
|
goto_xy(1,25);
|
|
|
|
|
printf("<EFBFBD>˳<EFBFBD> ESC");
|
|
|
|
|
|
|
|
|
|
const int i=8; //const <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1>ı<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DEB8><EFBFBD><EFBFBD>ݱȽϷ<C8BD><CFB7><EFBFBD>
|
|
|
|
|
const int j=19;
|
|
|
|
|
const int k=3;
|
|
|
|
|
goto_xy(game_xy.x-i,game_xy.y+k); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><D7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>巽<EFBFBD><E5B7BD>
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>");
|
|
|
|
|
goto_xy(game_xy.x-i,game_xy.y+k+2);
|
|
|
|
|
printf("<EFBFBD>ƶ<EFBFBD><EFBFBD><EFBFBD> <20><> W");
|
|
|
|
|
goto_xy(game_xy.x-i,game_xy.y+k+4);
|
|
|
|
|
printf(" <20><> S");
|
|
|
|
|
goto_xy(game_xy.x-i,game_xy.y+k+6);
|
|
|
|
|
printf(" <20><> A");
|
|
|
|
|
goto_xy(game_xy.x-i,game_xy.y+k+8);
|
|
|
|
|
printf(" <20><> D ");
|
|
|
|
|
goto_xy(game_xy.x-i,game_xy.y+k+10);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><> <20><>");
|
|
|
|
|
|
|
|
|
|
goto_xy(game_xy.x+j,game_xy.y+k); //<2F><><EFBFBD><EFBFBD><EFBFBD>ҷ<EFBFBD><D2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>巽<EFBFBD><E5B7BD>
|
|
|
|
|
printf("<EFBFBD>ҷ<EFBFBD><EFBFBD><EFBFBD> <20><>");
|
|
|
|
|
goto_xy(game_xy.x+j,game_xy.y+k+2);
|
|
|
|
|
printf("<EFBFBD>ƶ<EFBFBD><EFBFBD><EFBFBD> <20><> <20><>");
|
|
|
|
|
goto_xy(game_xy.x+j,game_xy.y+k+4);
|
|
|
|
|
printf(" <20><> <20><>");
|
|
|
|
|
goto_xy(game_xy.x+j,game_xy.y+k+6);
|
|
|
|
|
printf(" <20><> <20><>");
|
|
|
|
|
goto_xy(game_xy.x+j,game_xy.y+k+8);
|
|
|
|
|
printf(" <20><> <20><>");
|
|
|
|
|
goto_xy(game_xy.x+j,game_xy.y+k+10);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: Enter");
|
|
|
|
|
|
|
|
|
|
for(int k1=0; k1<200; k1++) //<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>Ӽ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD>ڵڶ<DAB5><DAB6><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
for(int k2=0; k2<200; k2++)
|
|
|
|
|
Q[k1][k2]=0;
|
|
|
|
|
|
|
|
|
|
for(int i=0; i<20; i++) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if(i==0) //<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
|
|
|
|
|
{
|
|
|
|
|
goto_xy(10,i+3);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ЩЩЩЩЩЩЩЩЩЩЩЩЩЩЩЩЩЩ<EFBFBD>");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if(i!=0&&i!=19) //<2F><><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD>16<31><36>
|
|
|
|
|
{
|
|
|
|
|
goto_xy(10,i+3);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
if(i==19) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
|
|
|
|
|
{
|
|
|
|
|
goto_xy(10,i+3);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ةةةةةةةةةةةةةةةةةة<EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
point.x=19;
|
|
|
|
|
point.y=12;
|
|
|
|
|
goto_xy(19,12);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Clean() //<2F><><EFBFBD><EFBFBD>-<2D><><EFBFBD>˶<EFBFBD><CBB6>Ĺ켣
|
|
|
|
|
{
|
|
|
|
|
goto_xy(10,3);
|
|
|
|
|
printf(" ");
|
|
|
|
|
goto_xy(24,3);
|
|
|
|
|
printf(" ");
|
|
|
|
|
goto_xy(10,4);
|
|
|
|
|
printf(" ");
|
|
|
|
|
goto_xy(24,4);
|
|
|
|
|
printf(" ");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void menu_choose(char press) //ѡ<><D1A1><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
if(press==72) //<2F><><EFBFBD><EFBFBD>ASCLL<4C><4C>
|
|
|
|
|
{
|
|
|
|
|
if(point.y==3)
|
|
|
|
|
point.y=4;
|
|
|
|
|
else
|
|
|
|
|
point.y=3;
|
|
|
|
|
Clean();
|
|
|
|
|
goto_xy(10,point.y);
|
|
|
|
|
printf("-<2D><>");
|
|
|
|
|
}
|
|
|
|
|
if(press==80) //<2F><><EFBFBD><EFBFBD>ASCLL<4C><4C>
|
|
|
|
|
{
|
|
|
|
|
if(point.y==4)
|
|
|
|
|
point.y=3;
|
|
|
|
|
else
|
|
|
|
|
point.y=4;
|
|
|
|
|
Clean();
|
|
|
|
|
goto_xy(10,point.y);
|
|
|
|
|
printf("-<2D><>");
|
|
|
|
|
}
|
|
|
|
|
if(press==13) // 13<31><33><EFBFBD>س<EFBFBD><D8B3><EFBFBD><EFBFBD><EFBFBD>ASCLL<4C><4C>
|
|
|
|
|
{
|
|
|
|
|
startchoice=point.y-2; //startchoice Ϊ1<CEAA><31>2
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void go_back(int x1,int y1) //<2F><><EFBFBD>庯<EFBFBD><E5BAAF>
|
|
|
|
|
{
|
|
|
|
|
goto_xy(x1,y1);
|
|
|
|
|
if(x1==10)
|
|
|
|
|
{
|
|
|
|
|
if(y1==3)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
else if(y1==20)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if(x1==27)
|
|
|
|
|
{
|
|
|
|
|
if(y1==3)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
else if(y1==20)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if(y1==3)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
else if(y1==20)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Q[point.x][point.y]=0; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>н<EFBFBD><D0BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӷ<EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0
|
|
|
|
|
goto_xy(x1,y1);
|
|
|
|
|
}
|