You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

486 lines
14 KiB

6 years ago
#include<stdio.h>
#include<stdlib.h>
#include<windows.h>
#include<conio.h>
#define N 100
6 years ago
char c, j; //<2F><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD>
int score1=0, score2=0; //<2F><><EFBFBD><EFBFBD>
6 years ago
int map[N][N]={0}; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̵ij<CCB5>ʼֵΪ0
6 years ago
void gamestart(); //<2F><>Ϸ<EFBFBD><CFB7>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
void help(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E6A3AC>֪<EFBFBD><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>β<EFBFBD><CEB2><EFBFBD>
void gotoxy(int ,int ); //<2F><><EFBFBD>ƹ<EFBFBD><C6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD>
6 years ago
void creatmap(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void playchess(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int judge1(int ,int ); //<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int judge2(int ,int ); //<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD>Ҷ<EFBFBD><D2B6>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void renew(); //<2F><><EFBFBD><EFBFBD><EFBFBD>ָ̻<CCBB><D6B8>ɳ<EFBFBD>ʼֵ0
void scoring(int ); //<2F>Ʒ<EFBFBD>
void game_over(); //һ<><D2BB><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD>
int main()
{
system("COLOR F0"); //<2F><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
gamestart();
playchess();
return 0;
}
/*----------------------------------------------------------*/
void gamestart() //<2F><>Ϸ<EFBFBD><CFB7>ʼ<EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>
{
gotoxy(45,15);
printf("<EFBFBD><EFBFBD>ӭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ");
gotoxy(45,18);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
getch();
6 years ago
system("cls"); //<2F><><EFBFBD><EFBFBD>
6 years ago
help();
}
/*-----------------------------------------------------------*/
void help()
{
gotoxy(45,10);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӣ<EFBFBD><EFBFBD>״̬<EFBFBD>½<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
gotoxy(45,13);
printf("һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊw<EFBFBD><EFBFBD>s<EFBFBD><EFBFBD>a<EFBFBD><EFBFBD>d<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ң<EFBFBD><EFBFBD>ո<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
gotoxy(45,14);
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><EFBFBD><EFBFBD>");
gotoxy(45,15);
printf("<EFBFBD><EFBFBD>Backspace<EFBFBD><EFBFBD><EFBFBD>ɻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ESC<EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD>Ϸ");
gotoxy(45,18);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
getch();
system("cls");
}
/*-----------------------------------------------------------*/
void game_over()
{
char z;
system("cls");
gotoxy(45,10);
printf("<EFBFBD><EFBFBD>Ϸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><EFBFBD>");
gotoxy(45,11);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD>밴Y/y<><79><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD>밴N/n");
lable3: //<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ǩ<EFBFBD><C7A9>
{
z=getch();
if(z!='Y' && z!='y' && z!='N' && z!='n')
{
gotoxy(45,14);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
goto lable3; //<2F><><EFBFBD>½<EFBFBD><C2BD>б<EFBFBD>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}
if(z=='Y' || z=='y')
{
system("cls");
renew();
playchess();
}
if(z=='Z' || z=='n')
{
exit(0);
}
}
}
/*-----------------------------------------------------------*/
void gotoxy(int x, int y) //<2F><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>y<EFBFBD>еĵ<D0B5>x<EFBFBD><78>
{
int xx=0x0b;
HANDLE hOutput;
COORD loc;
loc.X = x;
loc.Y=y;
hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hOutput, loc);
return;
}
/*------------------------------------------------------------*/
void gotoprint(int x,int y)
{
gotoxy(x,y);
printf("<EFBFBD><EFBFBD>");
}
void gotoprint2(int x,int y)
{
gotoxy(x,y);
printf("<EFBFBD><EFBFBD> ");
}
void gotoprint3(int x,int y)
{
gotoxy(x,y);
printf("<EFBFBD><EFBFBD>");
}
void gotoprint4(int x,int y)
{
gotoxy(x,y);
printf("<EFBFBD><EFBFBD>");
}
void gotoprint5(int x,int y)
{
gotoxy(x,y);
printf("<EFBFBD><EFBFBD>");
}
void gotoprint6(int x,int y)
{
gotoxy(x,y);
printf("-");
}
void gotoprint7(int x,int y)
{
gotoxy(x,y);
printf("<EFBFBD><EFBFBD>");
}
/*-------------------------------------------------------------*/
void creatmap()
{
int i, j;
gotoxy(0,1);
printf("<EFBFBD><EFBFBD>");
for(i=1;i<=39;i++) //<2F><><EFBFBD><EFBFBD><EFBFBD>ϵı<CFB5><C4B1><EFBFBD><EBB7AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!!!!
{
if(i%2!=0)
{
gotoprint6(i,1);
gotoprint6(i,21);
}
else
{
gotoprint(i,1);
gotoprint5(i,21);
}
}
gotoxy(0,21);
printf("<EFBFBD><EFBFBD>");
gotoxy(40,1);
printf("<EFBFBD><EFBFBD>");
for(i=2;i<=20;i++)
{
gotoprint2(0,i);
gotoprint4(40,i);
}
for(i=2;i<40;i+=2)
{
for(j=2;j<=20;j++)
gotoprint3(i,j);
}
gotoxy(40,21);
printf("<EFBFBD><EFBFBD>");
printf("\n");
}
/*-------------------------------------------------------------*/
void playchess()
{
creatmap();
gotoxy(45,5);
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>");
int whoturn=0; //<2F>ж<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>Ƕ<EFBFBD><C7B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int a=2, b=2; //<2F><>Ϸ<EFBFBD>տ<EFBFBD>ʼʱ<CABC><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>λ<EFBFBD><CEBB>
int q, w, e, r; //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
while(1)
{
if(whoturn%2==0)
{
lable1: //<2F><><EFBFBD>ñ<EFBFBD>ǩһ<C7A9><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>
{
c=1;
gotoxy(18,0);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
gotoxy(45,10);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ң<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"); //<2F><>ʾһ<CABE><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
while(c!=' ')
{
c=getch();
switch (c)
{
case 'w': //<2F><><EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ
{
gotoxy(a,b-1);
b-=1;
break;
}
case 's': //<2F><><EFBFBD>£<EFBFBD><C2A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ
{
gotoxy(a,b+1);
b+=1;
break;
}
case 'a': //<2F><><EFBFBD>󣬺<EFBFBD><F3A3ACBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
gotoxy(a-2,b);
a-=2;
break;
}
case 'd': //<2F><><EFBFBD>ң<EFBFBD><D2A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӷ<EFBFBD>
{
gotoxy(a+2,b);
a+=2;
break;
}
}
q=a,w=b;
if(c==' ') //<2F><><EFBFBD>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
gotoxy(a,b);
if(map[a][b]==1 || map[a][b]==2) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>µĵط<C4B5>Ϊ<EFBFBD>Ѿ<EFBFBD><D1BE>¹<EFBFBD><C2B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD>ط<EFBFBD><D8B7><EFBFBD><EFBFBD><EFBFBD>
goto lable1;
map[a][b]=2; //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵĵط<C4B5><D8B7><EFBFBD>ֵ<EFBFBD><D6B5>Ϊ2<CEAA><32><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
printf("<EFBFBD><EFBFBD>"); //һ<><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>
if(judge1(a,b)==1) //һ<><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
scoring(1);
gotoxy(45,15);
printf("<EFBFBD><EFBFBD>ϲһ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʤ<EFBFBD><EFBFBD>!!!\a");
Sleep(2000); //<2F>ӳ<EFBFBD><D3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>Ϸ
game_over(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}
}
if(c==8) //Backspace<63><65><EFBFBD><EFBFBD>ASCII<49><49>Ϊ8
{
gotoprint3(e,r);
whoturn--; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ص<EFBFBD><D8B5><EFBFBD>һ<EFBFBD>εĶ<CEB5><C4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
goto lable2;
}
if(c==27) //ESC<53><43><EFBFBD><EFBFBD>ASCII<49><49>Ϊ27
{
system("cls");
exit(0); //ʵ<>ְ<EFBFBD>ESC<53><43><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>Ϸ<EFBFBD>Ĺ<EFBFBD><C4B9><EFBFBD>
}
}
}
}
if(whoturn%2==1)
{
lable2: //<2F><><EFBFBD>ñ<EFBFBD>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>
{
j=1;
gotoxy(18,0);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
gotoxy(45,10);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ң<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"); //<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
while(j!=13)
{
j=getch();
if(j==0xE0) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD>Եý<D4B5><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
j=getch();
switch (j)
{
case 72: //<2F><><EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ
{
gotoxy(a,b-1);
b-=1;
break;
}
case 80: //<2F><><EFBFBD>£<EFBFBD><C2A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ
{
gotoxy(a,b+1);
b+=1;
break;
}
case 75: //<2F><><EFBFBD>󣬺<EFBFBD><F3A3ACBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
gotoxy(a-2,b);
a-=2;
break;
}
case 77: //<2F><><EFBFBD>ң<EFBFBD><D2A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӷ<EFBFBD>
{
gotoxy(a+2,b);
a+=2;
break;
}
}
e=a,r=b;
if(j==13) //Enter<65><72><EFBFBD><EFBFBD>ASCII<49><49>Ϊ13<31><33><EFBFBD><EFBFBD>Enter<65><72>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
{
gotoxy(a,b);
if(map[a][b]==2 || map[a][b]==1) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>µĵط<C4B5>Ϊ<EFBFBD>Ѿ<EFBFBD><D1BE>¹<EFBFBD><C2B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD>ط<EFBFBD><D8B7><EFBFBD><EFBFBD><EFBFBD>
goto lable2;
map[a][b]=1; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵĵط<C4B5><D8B7><EFBFBD>ֵ<EFBFBD><D6B5>Ϊ1<CEAA><31><EFBFBD><EFBFBD><EFBFBD>ж϶<D0B6><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
printf("<EFBFBD><EFBFBD>"); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>
if(judge2(a,b)==1)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
scoring(2);
gotoxy(45,15);
printf("<EFBFBD><EFBFBD>ϲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʤ<EFBFBD><EFBFBD>!!!\a");
Sleep(2000); //<2F>ӳ<EFBFBD><D3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
game_over(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}
}
if(j==8) //һ<><D2BB><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>
{
gotoprint3(q,w);
whoturn--; //<2F>ص<EFBFBD><D8B5><EFBFBD>һ<EFBFBD>ε<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
goto lable1;
}
if(j==27) //<2F>˳<EFBFBD>
{
system("cls");
exit(0);
}
}
}
}
whoturn++;
if(whoturn==360) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD>ֳ<EFBFBD>ʤ<EFBFBD><CAA4>Ϊƽ<CEAA><C6BD>
{
gotoxy(45,15);
printf("ƽ<EFBFBD><EFBFBD>");
Sleep(2000); //<2F>ӳ<EFBFBD><D3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
system("cls");
renew(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ĺۼ<C4BA>
playchess(); //<2F><>ʼ<EFBFBD>µ<EFBFBD>һ<EFBFBD><D2BB>
}
}
}
/*----------------------------------------------------------*/
int judge1(int x,int y) //<2F>ж<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>ʤ<EFBFBD><CAA4>
{
int i, j;
for(i=x-8;i<=x+8;i++)//<2F>жϺ<D0B6>
{
if(map[i][y]==2 && map[i+2][y]==2 && map[i+4][y]==2 && map[i+6][y]==2 && map[i+8][y]==2)
{
gotoprint7(i,y),gotoprint7(i+2,y),gotoprint7(i+4,y),gotoprint7(i+6,y),gotoprint7(i+8,y); //<2F><>ʤ<EFBFBD><CAA4><EFBFBD><EFBFBD><E3BDAB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
return 1;
}
else
continue;
}
for(j=y-4;j<=y+4;j++)//<2F>ж<EFBFBD><D0B6><EFBFBD>
{
if(map[x][j]==2 && map[x][j+1]==2 && map[x][j+2]==2 && map[x][j+3]==2 && map[x][j+4]==2)
{
gotoprint7(x,j),gotoprint7(x,j+1),gotoprint7(x,j+2),gotoprint7(x,j+3),gotoprint7(x,j+4);
return 1;
}
else
continue;
}
for(i=x-8,j=y-4;i<=x+8;i+=2,j++)//<2F>ж<EFBFBD><D0B6><EFBFBD>б
{
if(map[i][j]==2 && map[i+2][j+1]==2 && map[i+4][j+2]==2 && map[i+6][j+3]==2 && map[i+8][j+4]==2)
{
gotoprint7(i,j),gotoprint7(i+2,j+1),gotoprint7(i+4,j+2),gotoprint7(i+6,j+3),gotoprint7(i+8,j+4);
return 1;
}
else
continue;
}
for(i=x-8,j=y+4;i<=x+8;i+=2,j--)//<2F>ж<EFBFBD><D0B6><EFBFBD>б
{
if(map[i][j]==2 && map[i+2][j-1]==2 && map[i+4][j-2]==2 && map[i+6][j-3]==2 && map[i+8][j-4]==2)
{
gotoprint7(i,j),gotoprint7(i+2,j-1),gotoprint7(i+4,j-2),gotoprint7(i+6,j-3),gotoprint7(i+8,j-4);
return 1;
}
else
continue;
}
return 0;
}
/*----------------------------------------------------------*/
int judge2(int x,int y) //<2F>ж϶<D0B6><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>ʤ<EFBFBD><CAA4>
{
int i, j;
for(i=x-8;i<=x+8;i++)//<2F>жϺ<D0B6>
{
if(map[i][y]==1 && map[i+2][y]==1 && map[i+4][y]==1 && map[i+6][y]==1 && map[i+8][y]==1)
{
gotoprint7(i,y),gotoprint7(i+2,y),gotoprint7(i+4,y),gotoprint7(i+6,y),gotoprint7(i+8,y);
return 1;
}
else
continue;
}
for(j=y-4;j<=y+4;j++)//<2F>ж<EFBFBD><D0B6><EFBFBD>
{
if(map[x][j]==1 && map[x][j+1]==1 && map[x][j+2]==1 && map[x][j+3]==1 && map[x][j+4]==1)
{
gotoprint7(x,j),gotoprint7(x,j+1),gotoprint7(x,j+2),gotoprint7(x,j+3),gotoprint7(x,j+4);
return 1;
}
else
continue;
}
for(i=x-8,j=y-4;i<=x+8;i+=2,j++)//<2F>ж<EFBFBD><D0B6><EFBFBD>б
{
if(map[i][j]==1 && map[i+2][j+1]==1 && map[i+4][j+2]==1 && map[i+6][j+3]==1 && map[i+8][j+4]==1)
{
gotoprint7(i,j),gotoprint7(i+2,j+1),gotoprint7(i+4,j+2),gotoprint7(i+6,j+3),gotoprint7(i+8,j+4);
return 1;
}
else
continue;
}
for(i=x-8,j=y+4;i<=x+8;i+=2,j--)//<2F>ж<EFBFBD><D0B6><EFBFBD>б
{
if(map[i][j]==1 && map[i+2][j-1]==1 && map[i+4][j-2]==1 && map[i+6][j-3]==1 && map[i+8][j-4]==1)
{
gotoprint7(i,j),gotoprint7(i+2,j-1),gotoprint7(i+4,j-2),gotoprint7(i+6,j-3),gotoprint7(i+8,j-4);
return 1;
}
else
continue;
}
return 0;
}
/*----------------------------------------------------------*/
void renew()
{
int i, j;
for(i=0;i<=50;i++)
for(j=0;j<=50;j++)
{
map[i][j]=0;
}
}
/*----------------------------------------------------------*/
void scoring(int x)
{
FILE* fp;
char read[100];
6 years ago
if((fp=fopen("score.txt","w+"))==NULL)//w+<2B><><EFBFBD>ɶ<EFBFBD>д
6 years ago
{
gotoxy(55,10);
printf("The file can not be opened\n");
exit(1);
}
if(x==1)
score1+=1;
if(x==2)
score2+=1;
fputs("player1: ",fp);
fprintf(fp,"%d ",score1);
fputs("player2: ",fp);
fprintf(fp,"%d",score2);
6 years ago
rewind(fp); //<2F><>ָ<EFBFBD><D6B8><EFBFBD>ص<EFBFBD><D8B5>ļ<EFBFBD><C4BC><EFBFBD>ͷ
fgets(read,30,fp); //<2F><>ȡ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>Ƿְ<C7B7>
6 years ago
gotoxy(45,18);
6 years ago
printf("%s",read); //<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
6 years ago
}
6 years ago