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.
123 lines
3.9 KiB
123 lines
3.9 KiB
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <conio.h>
|
|
#include <string.h>
|
|
#define MAXIMUS 19
|
|
#define W 0x1177
|
|
#define S 0x1f73
|
|
#define A 0x1e61
|
|
#define D 0x2064
|
|
int p[MAXIMUS][MAXIMUS];
|
|
char buff[MAXIMUS*2+1][MAXIMUS*4+3];
|
|
int Cx,Cy;
|
|
int Now;
|
|
int wl,wp;
|
|
char* showText;
|
|
int count;
|
|
int bye();
|
|
int DoWin(int v);
|
|
char* Copy(char* strDest,const char* strSrc)
|
|
{
|
|
char* strDestCopy = strDest;
|
|
while (*strSrc!='\0')
|
|
{
|
|
*strDest++=*strSrc++;
|
|
}
|
|
return strDestCopy;
|
|
}
|
|
void Initialize()
|
|
{
|
|
int i,j;
|
|
showText="";
|
|
count=0;
|
|
for(i=0;i<MAXIMUS;i++)
|
|
{
|
|
for(j=0;j<MAXIMUS;j++)
|
|
{
|
|
p[i][j]=0;
|
|
}
|
|
}
|
|
Cx=Cy=MAXIMUS/2;
|
|
Now=1;
|
|
}
|
|
welcome() /*欢迎界面*/
|
|
{ Initialize(); /*初始化*/
|
|
system("cls"); /*清屏*/
|
|
system("color 2"); /*设置颜色*/
|
|
system("mode con cols=504 lines=512");/*样式*/
|
|
printf("\t╔════════════════╗\n");
|
|
printf("\t║ ║\n");
|
|
printf("\t║ 欢迎来到五子棋游戏,祝你玩的愉快! ║\n");
|
|
printf("\t║ ║\n");
|
|
printf("\t║ ._______________________. ║\n");
|
|
printf("\t║ | _____________________ | ║\n");
|
|
printf("\t║ | I I | ║\n");
|
|
printf("\t║ | I I | ║\n");
|
|
printf("\t║ | I 五 子 棋 I | ║\n");
|
|
printf("\t║ | I I | ║\n");
|
|
printf("\t║ | I___________________I | ║\n");
|
|
printf("\t║ !_______________________! ║\n");
|
|
printf("\t║ ._[__________]_. ║\n");
|
|
printf("\t║ .___|_______________|___. ║\n");
|
|
printf("\t║ |::: ____ | ║\n");
|
|
printf("\t║ | ~~~~ [CD-ROM] | ║\n");
|
|
printf("\t║ !_____________________! ║\n");
|
|
printf("\t║ ║\n");
|
|
printf("\t║ ║\n");
|
|
printf("\t║ ║\n");
|
|
printf("\t║ ║\n");
|
|
printf("\t║ 请按任意键继续,进入帮助界面。 ║\n");
|
|
printf("\t║ ▅▅ ║\n");
|
|
printf("\t║ ▅▅ ║\n");
|
|
printf("\t║ ▅▅ ║\n");
|
|
printf("\t║ ▅▅ ║\n");
|
|
printf("\t╚══════════════════╝\n");
|
|
getch();
|
|
}
|
|
DoWin(int v)
|
|
{
|
|
int n;
|
|
Initialize();
|
|
system("cls"); /*清屏*/
|
|
system("color F0"); /*设置颜色*/
|
|
if(v==1)
|
|
printf(" 黑方获得了胜利! \n");
|
|
if(v==2)
|
|
printf(" 白方获得了胜利! \n");
|
|
printf("\n\n\t╔──────────────────╗\n");
|
|
printf("\t║如 ║\n");
|
|
printf("\t║ 果 ║\n");
|
|
printf("\t║ 还 ║\n");
|
|
printf("\t║ 想 ║\n");
|
|
printf("\t║ 在 ║\n");
|
|
printf("\t║ 来 ║\n");
|
|
printf("\t║ 一 ║\n");
|
|
printf("\t║ 局 ║\n");
|
|
printf("\t║ 请 ║\n");
|
|
printf("\t║ 输 ║\n");
|
|
printf("\t║ 1 ║\n");
|
|
printf("\t║ 离 ║\n");
|
|
printf("\t║ 开 ║\n");
|
|
printf("\t║ 请 ║\n");
|
|
printf("\t║ 输 ║\n");
|
|
printf("\t║ 2 ║\n");
|
|
printf("\t║ ║\n");
|
|
printf("\t║ ║\n");
|
|
printf("\t╚━━━━━━━━━━━━━━━━━━╝\n");
|
|
scanf("%d",&n);
|
|
if(n==1)
|
|
printf("请按任意键继续");
|
|
if(n==2)
|
|
bye();
|
|
}
|
|
int main()//主函数
|
|
{welcome();
|
|
help();
|
|
system("title C语言五子棋游戏课程设计 ——湖工大通一李得龙,黄智");//设置标题
|
|
system("mode con cols=504 lines=512");//设置窗口大小
|
|
system("color F0");//设置颜色
|
|
while(1){//循环执行游戏
|
|
RunGame();
|
|
}
|
|
}
|