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.
dpzt/升级版(着色构成连珠的5个子).cpp

555 lines
11 KiB

6 years ago
//<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;
struct Point win_point[5];
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);
}
void Record() { //<2F><>¼<EFBFBD><C2BC><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD><EFBFBD>
p->coord.x=point.x;
p->coord.y=point.y;
ptr=p;
p=(struct Piece *)malloc(sizeof(struct Piece));
p->fore=ptr;
ShowWho();
Q[point.x][point.y]=player+1;
if(player) {
player=0;
return;
}
player=1;
goto_xy(point.x,point.y);
}
void PutDown() { //<2F><>ʾ<EFBFBD><CABE><EFBFBD>Ӻ<EFBFBD><D3BA><EFBFBD>
if(Q[point.x][point.y]==0) { //<2F><><EFBFBD>жϸ<D0B6>λ<EFBFBD><CEBB><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if(player) {
printf("<EFBFBD><EFBFBD>");
printf("\a"); //'\a'<27><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Record();
} else {
printf("<EFBFBD><EFBFBD>");
printf("\a");
Record();
}
goto_xy(point.x,point.y);
}
}
void Play(char ch) { //<2F><><EFBFBD>̵IJ<CCB5><C4B2><EFBFBD> <20>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if(player==1) { //<2F>׷<EFBFBD>
if(ch== 'W' || ch=='w') //W <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{ if(point.y<=3)
point.y=22;
else
point.y--;
goto_xy(point.x,point.y);
}
if(ch=='A' || ch=='a') { //A <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if(point.x<=10)
point.x=20;
else
point.x--;
goto_xy(point.x,point.y);
}
if(ch=='D' || ch=='d') { //D <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if(point.x>=20)
point.x=10;
else
point.x++;
goto_xy(point.x,point.y);
}
if(ch=='S' || ch=='s') { //S <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if(point.y>=22)
point.y=3;
else
point.y++;
goto_xy(point.x,point.y);
}
if(ch==32) { //<2F>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD>ASCLL<4C><4C> <09><><EFBFBD><EFBFBD>
PutDown();
}
} else {
if(ch==72) { //<2F><><EFBFBD><EFBFBD>ASCLL<4C><4C> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if(point.y<=3)
point.y=22;
else
point.y--;
goto_xy(point.x,point.y);
}
if(ch==75) { //<2F><><EFBFBD><EFBFBD>ASCLL<4C><4C> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if(point.x<=10)
point.x=20;
else
point.x--;
goto_xy(point.x,point.y);
}
if(ch==77) { //<2F><><EFBFBD><EFBFBD>ASCLL<4C><4C> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if(point.x>=20)
point.x=10;
else
point.x++;
goto_xy(point.x,point.y);
}
if(ch==80) { //<2F><><EFBFBD><EFBFBD>ASCLL<4C><4C> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if(point.y>=22)
point.y=3;
else
point.y++;
goto_xy(point.x,point.y);
}
if(ch==13) { //<2F>س<EFBFBD><D8B3><EFBFBD><EFBFBD><EFBFBD>ASCLL<4C><4C> <09><><EFBFBD><EFBFBD>
PutDown();
}
}
if(button=='b'||button=='B') { //<2F><><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>
ptr1=p;
if(p!=head) {
p=p->fore;
free(ptr1);
point.x=p->coord.x;
point.y=p->coord.y;
go_back(point.x,point.y);
}
}
}
void judgeWinRecodePointXY(int count, int rr, int cc){
win_point[count].x=rr; //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
win_point[count].y=cc; //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
}
void judgeWinSetPointCOlor() {
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CONSOLE_SCREEN_BUFFER_INFO csbiInfo; //<2F><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0>ɫ
GetConsoleScreenBufferInfo(handle, &csbiInfo); //<2F><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0>ɫ
WORD wOldColorAttrs = csbiInfo.wAttributes; //<2F><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0>ɫ
SetConsoleTextAttribute(handle,FOREGROUND_INTENSITY |FOREGROUND_RED|BACKGROUND_INTENSITY|BACKGROUND_GREEN); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
for(int i=0; i<5; i++) {
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
goto_xy(win_point[i].x, win_point[i].y);
if(!player) { //˭Ӯ˭<D3AE><CBAD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>ӣ<EFBFBD><D3A3><EFBFBD>ôplayer<65><72><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD>
printf("<EFBFBD><EFBFBD>");
} else {
printf("<EFBFBD><EFBFBD>");
}
}
SetConsoleTextAttribute(handle, wOldColorAttrs); //<2F>ָ<EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
}
int Judge() {
int count=0;
int pp=player==0?2:1; //<2F><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>
for(int c=0; c<200; c++) {
for(int r=0; r<200; r++) {
if(Q[r][c]!=pp)
continue;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int rr=r;
int cc=c;
judgeWinRecodePointXY(count, rr, cc); //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
while(--cc>=3 &&Q[rr][cc]==pp) {
count++;
judgeWinRecodePointXY(count, rr, cc); //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
}
cc=c;
judgeWinRecodePointXY(count, rr, cc); //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
while(++cc<23 &&Q[rr][cc]==pp) {
count++;
judgeWinRecodePointXY(count, rr, cc); //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
}
cc=c;
if(count>=4) {
judgeWinSetPointCOlor();
return pp;
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
count=0;
judgeWinRecodePointXY(count, rr, cc); //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
while(--rr>=10 &&Q[rr][cc]==pp) {
count++;
judgeWinRecodePointXY(count, rr, cc); //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
}
rr=r;
judgeWinRecodePointXY(count, rr, cc); //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
while(++rr<30 &&Q[rr][cc]==pp) {
count++;
judgeWinRecodePointXY(count, rr, cc); //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
}
rr=r;
if(count>=4) {
judgeWinSetPointCOlor();
return pp;
}
//<2F><><EFBFBD>б<E9B7B4><D0B1>
count=0;
judgeWinRecodePointXY(count, rr, cc); //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
cc--;
rr--;
while((cc>=3||rr>=10) &&Q[rr][cc]==pp) {
count++;
judgeWinRecodePointXY(count, rr, cc); //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
cc--;
rr--;
}
rr=r;
cc=c;
judgeWinRecodePointXY(count, rr, cc); //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
cc++;
rr++;
while((cc<23||rr<30) &&Q[rr][cc]==pp) {
count++;
judgeWinRecodePointXY(count, rr, cc); //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
cc++;
rr++;
}
rr=r;
cc=c;
if(count>=4) {
judgeWinSetPointCOlor();
return pp;
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><D0B1>
count=0;
judgeWinRecodePointXY(count, rr, cc); //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
cc++;
rr--;
while((cc<23||rr>=10) &&Q[rr][cc]==pp) {
judgeWinRecodePointXY(count, rr, cc); //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
count++;
cc++;
rr--;
}
rr=r;
cc=c;
judgeWinRecodePointXY(count, rr, cc); //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
cc--;
rr++;
while((cc>=3||rr<30) &&Q[rr][cc]==pp) {
judgeWinRecodePointXY(count, rr, cc); //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
count++;
cc--;
rr++;
}
rr=r;
cc=c;
if(count>=4) {
judgeWinSetPointCOlor();
return pp;
}
count=0;
}
}
return 0;
}
int main(void) {
int j=0,k=0;
system("color 4E"); //#include<windows.h> 4 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ E <20><><EFBFBD><EFBFBD><E5B5AD>ɫ
printf("\n <20><>ӭplay<61><79><EFBFBD><EFBFBD><EFBFBD>");
goto_xy(15,3);
printf("<EFBFBD><EFBFBD><EFBFBD>ߣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
goto_xy(17,5);
printf(" <20><><EFBFBD><EFBFBD>");
Sleep(3000);
system("cls");
while(1) {
Init(); //<2F><>ʼ<EFBFBD><CABC>
int winner=0;
Welcome(); //<2F><>ӭ<EFBFBD><D3AD><EFBFBD><EFBFBD>
while(1) { //<2F><>ȡ<EFBFBD>˵<EFBFBD>ѡ<EFBFBD><D1A1>
char choice=getch();
menu_choose(choice);
if(startchoice!=0)
break;
}
if(startchoice==1) { //ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD>ս
Draw();
goto_xy(17,24);
printf("<EFBFBD>ֵ<EFBFBD><EFBFBD>׷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
goto_xy(point.x,point.y);
while(1) {
button=getch();
Play(button); //<2F><>ȡ<EFBFBD><C8A1><EFBFBD>̵IJ<CCB5><C4B2><EFBFBD> <20>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if(button==27) { //ESC<53><43>ASCLL<4C><4C>
if(MessageBox(NULL,TEXT("ȷ<EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD>"),TEXT(""),MB_ICONQUESTION|MB_OKCANCEL)==IDOK) {
system("cls");
printf("\n ллʹ<D0BB>ã<EFBFBD>\n");
return 0;
}
}
if(button==13 || button==32) //<2F>س<EFBFBD><D8B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߿ո<DFBF><D5B8><EFBFBD>ASCLL<4C><4C> <09><><EFBFBD>º<EFBFBD><C2BA><EFBFBD>ʼ<EFBFBD>ж<EFBFBD><D0B6><EFBFBD>Ӯ
winner=Judge();
if(winner!=0) {
goto_xy(15,26);
if(winner==2) {
printf("<EFBFBD><EFBFBD>ϲ<EFBFBD><EFBFBD><EFBFBD>׷<EFBFBD>Ӯ<EFBFBD><EFBFBD>\n");
j=j+1;
}
if(winner==1) {
printf("<EFBFBD><EFBFBD>ϲ<EFBFBD><EFBFBD><EFBFBD>ҷ<EFBFBD>Ӯ<EFBFBD><EFBFBD>\n");
k=k+1;
}
goto_xy(29,24);
printf("<EFBFBD><EFBFBD> %d : %d <20><>",j,k);
}
if(winner!=1&&winner!=2) {
continue;
}
goto_xy(13,24);
printf(" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ?(Y/N): ");
while(1) {
button=getch();
if(button=='n'||button=='N'||button=='y'||button=='Y')
break;
}
if(button=='n'||button=='N') {
if(MessageBox(NULL,TEXT(" ȷ<><C8B7><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>"),TEXT(""),MB_ICONQUESTION|MB_OKCANCEL)==IDOK) {
system("cls");
printf("\n ллʹ<D0BB>ã<EFBFBD>\n");
return 0;
}
}
if(button=='y'||button=='Y') {
winner=0;
system("cls");
break;
}
}
}
if(startchoice==2) {
if(MessageBox(NULL,TEXT(" ȷ<><C8B7><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>"),TEXT(""),MB_ICONQUESTION|MB_OKCANCEL)==IDOK) {
printf("\n\n ллʹ<D0BB>ã<EFBFBD>\n");
return 0;
}
}
}
return 0;
}