我很喜欢玩五子棋 但是 老师不让带 就自己写了串代码 大佬勿喷
具体如何实现,代码里都有解释
希望大家能看懂
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <string.h>
#define MAXIMUS 15 //定义棋盘大小
int p[MAXIMUS][MAXIMUS];//存储对局信息
char buff[MAXIMUS*2+1][MAXIMUS*4+3];//输出缓冲器
int Cx,Cy;//当前光标位置
int Now;//当前走子的玩家,1代表黑,2代表白
int wl,wp;//当前写入缓冲器的列数和行数位置
char* showText;//在棋盘中央显示的文字信息
int count;//回合数
void endg() {
system("color f0");
system("cls");
printf("\n ***********\n Game over!\n ***********\n ");
system("pause");
exit(0);
}
char* Copy(char* strDest,const char* strSrc) {
//修改过的字符串复制函数,会忽略末端的\0
char* strDestCopy = strDest;
while (*strSrc) {
*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;//重置当前为黑方
}
char* getStyle(int i,int j) {
//获得棋盘中指定坐标交点位置的字符,通过制表符拼成棋盘
if(p[i][j]==1)//1为黑子
return "●";
else if(p[i][j]==2)//2为白子
return "○";
else if(i==0&&j==0)//以下为边缘棋盘样式
return "┏";
else if(i==MAXIMUS-1&&j==0)
return "┓";
else if(i==MAXIMUS-1&&j==MAXIMUS-1)
return "┛";
else if(i==0&&j==MAXIMUS-1)