#includegraphics.h#includeconio.h#includestring.h#includebios.h#includestdlib.h#includec:\tc\LIB\1.c#defineW119#defineS115#defineA97#defineD100#definespace32#defineUP72#defineDOWN80#defineLEFT75#defineRIGHT77#defineENTER13voidqipan();voidjiemian(int);voidguangbiao1(int,int);voidguangbiao2(int,int);voidxuanzhong(int,int);voidgaizi(int,int);chararray(int,int);voidxiazi(int,int,int,int);/*intpanding(char,int,int,int,int);*/main(){intgdriver,gmode,i=0,c=0,x=190,y=190,m,n;charp;FILE*fp;gdriver=DETECT;gmode=0;if((fp=fopen(file.txt,at))==NULL){printf(Cannotopenfile!);system(pause);exit(0);}printf(%d,%d,gdriver,gmode);registerbgidriver(EGAVGA_driver);initgraph(&gdriver,&gmode,c:\\tc);cleardevice();while(c!=27){c=getch();clrscr();jiemian(i);if(c==80){fputs(down,fp);i++;if(i==4){i=0;}}if(i==1){if(c==13){fputs(enter,fp);qipan();c=getch();while(c!=27){c=getch();if(c==115){fputs(S,fp);y=y+40;guangbiao1(x,y);guangbiao2(x,y-40);}if(c==119){fputs(W,fp);y=y-40;guangbiao1(x,y);guangbiao2(x,y+40);}if(c==97){fputs(A\n,fp);x=x-40;guangbiao1(x,y);guangbiao2(x+40,y);}if(c==100){fputs(D\n,fp);x=x+40;guangbiao1(x,y);guangbiao2(x-40,y);}if(c==13){fputs(enter\n,fp);xuanzhong(x,y);m=x;n=y;}if(c==32){fputs(space\n,fp);xiazi(m,n,x,y);fputs(gaizi\n,fp);gaizi(m,n);}if(x350||y390||x30||y30){x=190;y=30;}}}}}getch();closegraph();fclose(fp);restorecrtmode();return0;}voidqipan(){inti,j;setbkcolor(GREEN);cleardevice();setlinestyle(0,0,3);setcolor(1);rectangle(10,10,370,410);rectangle(30,30,350,390);for(i=1;i8;i++){setlinestyle(0,0,3);line(i*40+30,30,i*40+30,190);line(i*40+30,230,i*40+30,390);}for(j=1;j9;j++){setlinestyle(0,0,3);line(30,j*40+30,350,j*40+30);}setlinestyle(3,0,3);line(150,30,230,110);line(230,30,150,110);line(150,310,230,390);line(230,310,150,390);setusercharsize(4,1,2,1);settextstyle(1,0,4);outtextxy(70,195,chinesechess);red_shuai(190,30);red_shi(150,30);red_shi(230,30);red_xiang(110,30);red_xiang(270,30);red_ma(70,30);red_ma(310,30);red_ju(30,30);red_ju(350,30);red_pao(70,110);red_pao(310,110);red_bing(30,150);red_bing(110,150);red_bing(190,150);red_bing(270,150);red_bing(350,150);black_jiang(190,390);black_shi(150,390);black_shi(230,390);black_xiang(110,390);black_xiang(270,390);black_ma(70,390);black_ma(310,390);black_ju(30,390);black_ju(350,390);black_pao(70,310);black_pao(310,310);black_zu(30,270);black_zu(110,270);black_zu(190,270);black_zu(270,270);black_zu(350,270);setcolor(BLUE);rectangle(400,30,600,320);setcolor(4);settextstyle(1,0,2);outtextxy(420,50,A-shuaiB-shi);outtextxy(420,80,C-xiangD-ma);outtextxy(420,110,E-juF-pao);outtextxy(420,140,G-bing);setcolor(8);outtextxy(420,200,H-jiangI-shi);outtextxy(420,230,J-xiangK-ma);outtextxy(420,260,L-juM-pao);outtextxy(420,290,N-zu);}voidjiemian(inti){setbkcolor(GREEN);cleardevice();settextstyle(1,0,8);setcolor(BLUE);outtextxy(50,70,chinesechess);settextstyle(0,0,3);setcolor(RED);outtextxy(260,215,start);outtextxy(260,255,again);outtextxy(260,295,undo);outtextxy(260,335,exit);rectangle(250,210+i*40,390,240+i*40);}voidguangbiao1(intx,inty){setcolor(WHITE);setlinestyle(0,0,3);line(x-17,y-7,x-17,y-17);line(x-7,y-17,x-17,y-17);line(x+7,y-17,x+17,y-17);line(x+17,y-7,x+17,y-17);line(x-7,y+17,x-17,y+17);line(x-17,y+7,x-17,y+17);line(x+17,y+7,x+17,y+17);line(x+7,y+17,x+17,y+17);}voidguangbiao2(intx,inty){setcolor(GREEN);setlinestyle(0,0,3);line(x-17,y-7,x-17,y-17);line(x-7,y-17,x-17,y-17);line(x+7,y-17,x+17,y-17);line(x+17,y-7,x+17,y-17);line(x-7,y+17,x-17,y+17);line(x-17,y+7,x-17,y+17);line(x+17,y+7,x+17,y+17);line(x+7,y+17,x+17,y+17);}voidxuanzhong(intx,inty){setcolor(CYAN);setlinestyle(0,0,3);circle(x,y,15);}voidgaizi(intx1,inty1){setlinestyle(0,0,3);setcolor(GREEN);circle(x1,y1,15);setfillstyle(0,3);floodfill(x1,y1,GREEN);setcolor(1);setlinestyle(0,0,3);if((30x1350)&&((y1==30)||(y1==230))){line(x1-18,y1,x1+18,y1);line(x1,y1,x1,y1+18);}if((30x1350)&&(y1==390||y1==190)){line(x1-18,y1,x1+18,y1);line(x1,y1-18,x1,y1);}if((30y1390)&&x1==30){line(x1,y1,x1+18,y1);line(x1,y1-18,x1,y1+18);}if((30y1390)&&(x1==350)){line(x1-18,y1,x1,y1);line(x1,y1-18,x1,y1+18);}if((x1==30)&&(y1==30)){line(x1,y1,x1+18,y1);line(x1,y1,x1,y1+18);}if((x1==350)&&(y1==30)){line(x1-18,y1,x1,y1);line(x1,y1,x1,y1+18);}if((x1==30)&&(y1==390)){line(x1,y1,x1+18,y1);line(x1,y1,x1,y1-18);}if((x1==350)&&(y1==390)){line(x1,y1,x1-18,y1);line(x1,y1,x1,y1-18);}else{line(x1-18,y1,x1+18,y1);line(x1,y1-18,x1,y1+18);}}chararray(inti,intj){chara[13][13];intc,b;c=i;b=j;for(c=1;c10;c++){for(b=1;b11;b++){a[c][b]='Z';}}a[1][5]='A';a[1][4]='B';a[1][6]='B';a[1][3]='C';a[1][7]='C';a[1][2]='D';a[1][8]='D';a[1][1]='E';a[1][9]='E';a[3][2]='F';a[3][8]='F';a[4][1]=a[4][3]=a[4][5]=a[4][7]=a[4][9]='G';a[10][5]='H';a[10][4]='I';a[10][6]='I';a[10][3]='J';a[10][7]='J';a[10][2]='K';a[10][8]='K';a[10][1]='L';a[10][9]='L';a[2][3]='M';a[8][3]='M';a[7][1]=a[7][3]=a[7][5]=a[7][7]=a[7][9]='N';returna[i][j];}voidxiazi(intx6,inty6,intx7,inty7){switch(array(y6/40+1,x6/40+1)){case'A':red_shuai(x7,y7);break;case'B':red_shi(x