当前位置:首页 > 代码 > 正文

五子棋游戏源代码(五子棋游戏源代码电脑文本文档)

admin 发布:2022-12-19 14:07 113


本篇文章给大家谈谈五子棋游戏源代码,以及五子棋游戏源代码电脑文本文档对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。

本文目录一览:

找五子棋源代码c++

#include "iostream"

#include iomanip

using namespace std;

const int M=20;

const int N=20;

int main()

{

char weizhi[M][N];

int k,i,j,x,y,flag=0;

cout"欢迎使用简易双人对战五子棋游戏"endl;

cout"五子棋棋谱如下:"endl;

for(k=0;k=N;k++)

coutsetw(3)setfill(' ')k;

coutendl;

for(i=1;i=M;i++)

{

coutsetw(3)setfill(' ')i;

for(j=1;j=N;j++)

{

weizhi[i][j]='-';

coutsetw(3)setfill(' ')weizhi[i][j];

}

coutendl;

}

while(flag==0)

{

//红方落子

cout"请红方输入落子位置:"endl;

loop1:

cout"请输入落子的行数:";

cinx;

cout"请输入落子的列数:";

ciny;

if(weizhi[x][y]=='-')

{

weizhi[x][y]='*';

for(k=0;k=N;k++)

coutsetw(3)setfill(' ')k;

coutendl;

for(i=1;i=M;i++)

{

coutsetw(3)setfill(' ')i;

for(j=1;j=N;j++)

coutsetw(3)setfill(' ')weizhi[i][j];

coutendl;

}

}

else

{

cout"你不能在这落子,请重新选择落子位置:"endl;

goto loop1;

}

//判断胜利

for(i=1;i=M-4;i++)

{

for(j=1;j=N-4;j++)

{

if(weizhi[i][j]=='*' weizhi[i][j+1]=='*' weizhi[i][j+2]=='*' weizhi[i][j+3]=='*' weizhi[i][j+4]=='*')

{

cout"恭喜红方获得简易双人对战五子棋的胜利!耶~~~"endl;

flag=1;

break;

}

if(weizhi[i][j]=='*' weizhi[i+1][j]=='*' weizhi[i+2][j]=='*' weizhi[i+3][j]=='*' weizhi[i+4][j]=='*')

{

cout"恭喜红方获得简易双人对战五子棋的胜利!耶~~~"endl;

flag=1;

break;

}

if(weizhi[i][j]=='*' weizhi[i+1][j+1]=='*' weizhi[i+2][j+2]=='*' weizhi[i+3][j+3]=='*' weizhi[i+4][j+4]=='*')

{

cout"恭喜红方获得简易双人对战五子棋的胜利!耶~~~"endl;

flag=1;

break;

}

if(flag==1)

break;

}

}

//蓝方落子

cout"请蓝方输入落子位置:"endl;

loop2:

cout"请输入落子的行数:";

cinx;

cout"请输入落子的列数:";

ciny;

if(weizhi[x][y]=='-')

{

weizhi[x][y]='#';

for(k=0;k=N;k++)

coutsetw(3)setfill(' ')k;

coutendl;

for(i=1;i=M;i++)

{

coutsetw(3)setfill(' ')i;

for(j=1;j=N;j++)

coutsetw(3)setfill(' ')weizhi[i][j];

coutendl;

}

}

else

{

cout"你不能在这落子,请重新选择落子位置:";

goto loop2;

}

//判断胜利

for(i=1;i=M-4;i++)

{

for(j=1;j=N-4;j++)

{

if(weizhi[i][j]=='#' weizhi[i][j+1]=='#' weizhi[i][j+2]=='#' weizhi[i][j+3]=='#' weizhi[i][j+4]=='#')

{

cout"恭喜蓝方获得简易双人对战五子棋的胜利!耶~~~"endl;

flag=1;

break;

}

if(weizhi[i][j]=='#' weizhi[i+1][j]=='#' weizhi[i+2][j]=='#' weizhi[i+3][j]=='#' weizhi[i+4][j]=='#')

{

cout"恭喜蓝方获得简易双人对战五子棋的胜利!耶~~~"endl;

flag=1;

break;

}

if(weizhi[i][j]=='#' weizhi[i+1][j+1]=='#' weizhi[i+2][j+2]=='#' weizhi[i+3][j+3]=='#' weizhi[i+4][j+4]=='#')

{

cout"恭喜蓝方获得简易双人对战五子棋的胜利!耶~~~"endl;

flag=1;

break;

}

if(flag==1)

break;

}

}

}

return 0;

}

我运行过,没有错误.

五子棋源代码html

js代码:

定义canvas及黑白棋变量

font color="#2f4f4f" face="微软雅黑" size="3"var canvas;

var context;

var isWhite = true;//设置是否该轮到白棋

var isWell = false;//设置该局棋盘是否赢了,如果赢了就不能再走了

var img_b = new Image();

img_b.src = "images/b.png";//白棋图片

var img_w = new Image();

img_w.src = "images/c.png";//黑棋图片/font

为棋盘的二维数组用来保存棋盘信息

font color="#2f4f4f" face="微软雅黑" size="3" var chessData = new Array(15);//初始化0为没有走过的,1为白棋走的,2为黑棋走的

for (var x = 0; x 15; x++) {

chessData[x] = new Array(15);

for (var y = 0; y 15; y++) {

chessData[x][y] = 0;

}

}/font

绘制棋盘的线

font color="#2f4f4f" face="微软雅黑" size="3" for (var i = 0; i = 640; i += 40) {

context.beginPath();

context.moveTo(0, i);

context.lineTo(640, i);

context.closePath();

context.stroke();

context.beginPath();

context.moveTo(i, 0);

context.lineTo(i, 640);

context.closePath();

context.stroke();

}

}/font

判断该棋局的输赢

font color="#2f4f4f" face="微软雅黑" size="3" if (count1 = 5 || count2 = 5 || count3 = 5 || count4 = 5) {

if (chess == 1) {

alert("白棋赢了");

}

else {

alert("黑棋赢了");

}

isWell = true;//设置该局棋盘已经赢了,不可以再走了

}/font

html代码:

font color="#2f4f4f" face="微软雅黑" size="3"body onload="drawRect()"

div

canvas width="640" id="canvas" onmousedown="play(event)" height="640"你的浏览器不支持HTML5 canvas ,请使用 google chrome 浏览器 打开.

/canvas

/div

/body/font

c ++五子棋源代码

其实,只需要做少量工作就可以了,判断下棋的人当前落子处,附近是否存在五子连珠就可以了,也就是4个方向(米字型),判断一下落子处附近是否有五子连珠就可以了

急求:五子棋的源代码(数据结构),每一步都要有解释的!!!

#includeiostream.h#includestdlib.h#define Num 15//********************************************************//类class T//定义类用来封装所有相关函数和变量{ char board[Num][Num];//用数组board[Num][Num]来定义棋盘public: void PrintMenu(); //打印菜单 说明游戏规则和方法 void PrintBoard(); //打印棋盘 void GameStart(char*,int ,int ,char); //下棋 int whichwin(int,int,char); //判断那个选手赢 void Choice(char ); //是否再玩 void Setboard(); //重置棋盘};//****************************************************************//main主函数void main ()//主函数{ T s;//说明类的一个对象s s.PrintMenu();//通过s调用PrintMenu函数提示如何游戏 char player1[20],player2[20];//玩家姓名 int FirstWin=0,SecondWin=0,Draws=0,x,y,N;//说明变量,赋初值为0以待计算输赢结果 char choice='Y'; cin.ignore(20,'\n');//输入输出流,前面如果有输入把输入行所有字符取空,以便后面的输入从新的一行开始 cout"请输入第一个玩家姓名:"; cin.getline(player1,20);//连续读取数据 cout"请输入第二个玩家姓名:"; cin.getline(player2,20); while(choice=='Y'||choice=='y')//条件成立,执行 { s.Setboard();//调用Setboard函数 N=0; while(N=(Num*Num)) { s.PrintBoard();//打印棋盘 s.GameStart(player1,x,y,'O'); N++;//记录已下棋子数 if(s.whichwin(x-1,y-1,'O'))//返回值不为0则条件成立 { s.PrintBoard(); coutplayer1"赢了。"endl; FirstWin++;//记录赢局数 break;//终止本次循环 } s.PrintBoard();//同上 s.GameStart(player2,x,y,'X'); N++; if(s.whichwin(x-1,y-1,'X')) { s.PrintBoard(); coutplayer2"赢了。"endl; SecondWin++; break; } if(N==(Num*Num)) { cout"和棋!"; Draws++;//记录平局数 break; } } s.Choice(choice);//给玩家提供一次选择是否再玩的机会 } //输出游戏输赢次数 coutplayer1"赢了"FirstWin"次"endl; coutplayer2"赢了"SecondWin"次"endl; cout"和"Draws"次"endl; cout"谢谢使用。"endl; cout"任意键继续。"endl; cin.get();//很必要的,目的是空度换行字符}//*******************************************************************//定义公有成员函数void T::PrintMenu(){ cout"欢迎进入五子棋游戏!\n"; cout"******************************************"endl; cout"\t游戏说明:"endlendl; cout"1.第一个玩家用O第二个玩家用X;"endl; cout"2.请根据提示输入所要走的行和列;"endl; cout"3.按Enter下棋。"endl; cout"

求五子棋C源代码

这个是稍微好一点的了,以前没事试过

/*

五子棋

*/

#includestdio.h

#includestdlib.h

#includegraphics.h

#includebios.h

#includeconio.h

#define LEFT 0x4b00

#define RIGHT 0x4d00

#define DOWN 0x5000

#define UP 0x4800

#define ESC 0x011b

#define SPACE 0x3920

#define BILI 20

#define JZ 4

#define JS 3

#define N 19

int box[N][N];

int step_x,step_y ;

int key ;

int flag=1 ;

void draw_box();

void draw_cicle(int x,int y,int color);

void change();

void judgewho(int x,int y);

void judgekey();

int judgeresult(int x,int y);

void attentoin();

void attention()

{

char ch ;

window(1,1,80,25);

textbackground(LIGHTBLUE);

textcolor(YELLOW);

clrscr();

gotoxy(15,2);

printf("游戏操作规则:");

gotoxy(15,4);

printf("Play Rules:");

gotoxy(15,6);

printf("1、按左右上下方向键移动棋子");

gotoxy(15,8);

printf("1. Press Left,Right,Up,Down Key to move Piece");

gotoxy(15,10);

printf("2、按空格确定落棋子");

gotoxy(15,12);

printf("2. Press Space to place the Piece");

gotoxy(15,14);

printf("3、禁止在棋盘外按空格");

gotoxy(15,16);

printf("3. DO NOT press Space outside of the chessboard");

gotoxy(15,18);

printf("你是否接受上述的游戏规则(Y/N)");

gotoxy(15,20);

printf("Do you accept the above Playing Rules? [Y/N]:");

while(1)

{

gotoxy(60,20);

ch=getche();

if(ch=='Y'||ch=='y')

break ;

else if(ch=='N'||ch=='n')

{

window(1,1,80,25);

textbackground(BLACK);

textcolor(LIGHTGRAY);

clrscr();

exit(0);

}

gotoxy(51,12);

printf(" ");

}

}

void draw_box()

{

int x1,x2,y1,y2 ;

setbkcolor(LIGHTBLUE);

setcolor(YELLOW);

gotoxy(7,2);

printf("Left, Right, Up, Down KEY to move, Space to put, ESC-quit.");

for(x1=1,y1=1,y2=18;x1=18;x1++)

line((x1+JZ)*BILI,(y1+JS)*BILI,(x1+JZ)*BILI,(y2+JS)*BILI);

for(x1=1,y1=1,x2=18;y1=18;y1++)

line((x1+JZ)*BILI,(y1+JS)*BILI,(x2+JZ)*BILI,(y1+JS)*BILI);

for(x1=1;x1=18;x1++)

for(y1=1;y1=18;y1++)

box[x1][y1]=0 ;

}

void draw_circle(int x,int y,int color)

{

setcolor(color);

setlinestyle(SOLID_LINE,0,1);

x=(x+JZ)*BILI ;

y=(y+JS)*BILI ;

circle(x,y,8);

}

void judgekey()

{

int i ;

int j ;

switch(key)

{

case LEFT :

if(step_x-10)

break ;

else

{

for(i=step_x-1,j=step_y;i=1;i--)

if(box[i][j]==0)

{

draw_circle(step_x,step_y,LIGHTBLUE);

break ;

}

if(i1)break ;

step_x=i ;

judgewho(step_x,step_y);

break ;

}

case RIGHT :

if(step_x+118)

break ;

else

{

for(i=step_x+1,j=step_y;i=18;i++)

if(box[i][j]==0)

{

draw_circle(step_x,step_y,LIGHTBLUE);

break ;

}

if(i18)break ;

step_x=i ;

judgewho(step_x,step_y);

break ;

}

case DOWN :

if((step_y+1)18)

break ;

else

{

for(i=step_x,j=step_y+1;j=18;j++)

if(box[i][j]==0)

{

draw_circle(step_x,step_y,LIGHTBLUE);

break ;

}

if(j18)break ;

step_y=j ;

judgewho(step_x,step_y);

break ;

}

case UP :

if((step_y-1)0)

break ;

else

{

for(i=step_x,j=step_y-1;j=1;j--)

if(box[i][j]==0)

{

draw_circle(step_x,step_y,LIGHTBLUE);

break ;

}

if(j1)break ;

step_y=j ;

judgewho(step_x,step_y);

break ;

}

case ESC :

break ;

case SPACE :

if(step_x=1step_x=18step_y=1step_y=18)

{

if(box[step_x][step_y]==0)

{

box[step_x][step_y]=flag ;

if(judgeresult(step_x,step_y)==1)

{

sound(1000);

delay(1000);

nosound();

gotoxy(30,4);

if(flag==1)

{

setbkcolor(BLUE);

cleardevice();

setviewport(100,100,540,380,1);

/*定义一个图形窗口*/

setfillstyle(1,2);

/*绿色以实填充*/

setcolor(YELLOW);

rectangle(0,0,439,279);

floodfill(50,50,14);

setcolor(12);

settextstyle(1,0,5);

/*三重笔划字体, 水平放?5倍*/

outtextxy(20,20,"The White Win !");

setcolor(15);

settextstyle(3,0,5);

/*无衬笔划字体, 水平放大5倍*/

outtextxy(120,120,"The White Win !");

setcolor(14);

settextstyle(2,0,8);

getch();

closegraph();

exit(0);

}

if(flag==2)

{

setbkcolor(BLUE);

cleardevice();

setviewport(100,100,540,380,1);

/*定义一个图形窗口*/

setfillstyle(1,2);

/*绿色以实填充*/

setcolor(YELLOW);

rectangle(0,0,439,279);

floodfill(50,50,14);

setcolor(12);

settextstyle(1,0,8);

/*三重笔划字体, 水平放大8倍*/

outtextxy(20,20,"The Red Win !");

setcolor(15);

settextstyle(3,0,5);

/*无衬笔划字体, 水平放大5倍*/

outtextxy(120,120,"The Red Win !");

setcolor(14);

settextstyle(2,0,8);

getch();

closegraph();

exit(0);

}

}

change();

break ;

}

}

else

break ;

}

}

void change()

{

if(flag==1)

flag=2 ;

else

flag=1 ;

}

void judgewho(int x,int y)

{

if(flag==1)

draw_circle(x,y,15);

if(flag==2)

draw_circle(x,y,4);

}

int judgeresult(int x,int y)

{

int j,k,n1,n2 ;

while(1)

{

n1=0 ;

n2=0 ;

/*水平向左数*/

for(j=x,k=y;j=1;j--)

{

if(box[j][k]==flag)

n1++;

else

break ;

}

/*水平向右数*/

for(j=x,k=y;j=18;j++)

{

if(box[j][k]==flag)

n2++;

else

break ;

}

if(n1+n2-1=5)

{

return(1);

break ;

}

/*垂直向上数*/

n1=0 ;

n2=0 ;

for(j=x,k=y;k=1;k--)

{

if(box[j][k]==flag)

n1++;

else

break ;

}

/*垂直向下数*/

for(j=x,k=y;k=18;k++)

{

if(box[j][k]==flag)

n2++;

else

break ;

}

if(n1+n2-1=5)

{

return(1);

break ;

}

/*向左上方数*/

n1=0 ;

n2=0 ;

for(j=x,k=y;j=1,k=1;j--,k--)

{

if(box[j][k]==flag)

n1++;

else

break ;

}

/*向右下方数*/

for(j=x,k=y;j=18,k=18;j++,k++)

{

if(box[j][k]==flag)

n2++;

else

break ;

}

if(n1+n2-1=5)

{

return(1);

break ;

}

/*向右上方数*/

n1=0 ;

n2=0 ;

for(j=x,k=y;j=18,k=1;j++,k--)

{

if(box[j][k]==flag)

n1++;

else

break ;

}

/*向左下方数*/

for(j=x,k=y;j=1,k=18;j--,k++)

{

if(box[j][k]==flag)

n2++;

else

break ;

}

if(n1+n2-1=5)

{

return(1);

break ;

}

return(0);

break ;

}

}

void main()

{

int gdriver=VGA,gmode=VGAHI;

clrscr();

attention();

initgraph(gdriver,gmode,"c:\\tc");

/* setwritemode(XOR_PUT);*/

flag=1 ;

draw_box();

do

{

step_x=0 ;

step_y=0 ;

/*draw_circle(step_x,step_y,8); */

judgewho(step_x-1,step_y-1);

do

{

while(bioskey(1)==0);

key=bioskey(0);

judgekey();

}

while(key!=SPACEkey!=ESC);

}

while(key!=ESC);

closegraph();

}

急求五子棋源代码

/*

五子棋

*/

#includestdio.h

#includestdlib.h

#includegraphics.h

#includebios.h

#includeconio.h

#define LEFT 0x4b00

#define RIGHT 0x4d00

#define DOWN 0x5000

#define UP 0x4800

#define ESC 0x011b

#define SPACE 0x3920

#define BILI 20

#define JZ 4

#define JS 3

#define N 19

int box[N][N];

int step_x,step_y ;

int key ;

int flag=1 ;

void draw_box();

void draw_cicle(int x,int y,int color);

void change();

void judgewho(int x,int y);

void judgekey();

int judgeresult(int x,int y);

void attentoin();

void attention()

{

char ch ;

window(1,1,80,25);

textbackground(LIGHTBLUE);

textcolor(YELLOW);

clrscr();

gotoxy(15,2);

printf("游戏操作规则:");

gotoxy(15,4);

printf("Play Rules:");

gotoxy(15,6);

printf("1、按左右上下方向键移动棋子");

gotoxy(15,8);

printf("1. Press Left,Right,Up,Down Key to move Piece");

gotoxy(15,10);

printf("2、按空格确定落棋子");

gotoxy(15,12);

printf("2. Press Space to place the Piece");

gotoxy(15,14);

printf("3、禁止在棋盘外按空格");

gotoxy(15,16);

printf("3. DO NOT press Space outside of the chessboard");

gotoxy(15,18);

printf("你是否接受上述的游戏规则(Y/N)");

gotoxy(15,20);

printf("Do you accept the above Playing Rules? [Y/N]:");

while(1)

{

gotoxy(60,20);

ch=getche();

if(ch=='Y'||ch=='y')

break ;

else if(ch=='N'||ch=='n')

{

window(1,1,80,25);

textbackground(BLACK);

textcolor(LIGHTGRAY);

clrscr();

exit(0);

}

gotoxy(51,12);

printf(" ");

}

}

void draw_box()

{

int x1,x2,y1,y2 ;

setbkcolor(LIGHTBLUE);

setcolor(YELLOW);

gotoxy(7,2);

printf("Left, Right, Up, Down KEY to move, Space to put, ESC-quit.");

for(x1=1,y1=1,y2=18;x1=18;x1++)

line((x1+JZ)*BILI,(y1+JS)*BILI,(x1+JZ)*BILI,(y2+JS)*BILI);

for(x1=1,y1=1,x2=18;y1=18;y1++)

line((x1+JZ)*BILI,(y1+JS)*BILI,(x2+JZ)*BILI,(y1+JS)*BILI);

for(x1=1;x1=18;x1++)

for(y1=1;y1=18;y1++)

box[x1][y1]=0 ;

}

void draw_circle(int x,int y,int color)

{

setcolor(color);

setlinestyle(SOLID_LINE,0,1);

x=(x+JZ)*BILI ;

y=(y+JS)*BILI ;

circle(x,y,8);

}

void judgekey()

{

int i ;

int j ;

switch(key)

{

case LEFT :

if(step_x-10)

break ;

else

{

for(i=step_x-1,j=step_y;i=1;i--)

if(box[i][j]==0)

{

draw_circle(step_x,step_y,LIGHTBLUE);

break ;

}

if(i1)break ;

step_x=i ;

judgewho(step_x,step_y);

break ;

}

case RIGHT :

if(step_x+118)

break ;

else

{

for(i=step_x+1,j=step_y;i=18;i++)

if(box[i][j]==0)

{

draw_circle(step_x,step_y,LIGHTBLUE);

break ;

}

if(i18)break ;

step_x=i ;

judgewho(step_x,step_y);

break ;

}

case DOWN :

if((step_y+1)18)

break ;

else

{

for(i=step_x,j=step_y+1;j=18;j++)

if(box[i][j]==0)

{

draw_circle(step_x,step_y,LIGHTBLUE);

break ;

}

if(j18)break ;

step_y=j ;

judgewho(step_x,step_y);

break ;

}

case UP :

if((step_y-1)0)

break ;

else

{

for(i=step_x,j=step_y-1;j=1;j--)

if(box[i][j]==0)

{

draw_circle(step_x,step_y,LIGHTBLUE);

break ;

}

if(j1)break ;

step_y=j ;

judgewho(step_x,step_y);

break ;

}

case ESC :

break ;

case SPACE :

if(step_x=1step_x=18step_y=1step_y=18)

{

if(box[step_x][step_y]==0)

{

box[step_x][step_y]=flag ;

if(judgeresult(step_x,step_y)==1)

{

sound(1000);

delay(1000);

nosound();

gotoxy(30,4);

if(flag==1)

{

setbkcolor(BLUE);

cleardevice();

setviewport(100,100,540,380,1);

/*定义一个图形窗口*/

setfillstyle(1,2);

/*绿色以实填充*/

setcolor(YELLOW);

rectangle(0,0,439,279);

floodfill(50,50,14);

setcolor(12);

settextstyle(1,0,5);

/*三重笔划字体, 水平放?5倍*/

outtextxy(20,20,"The White Win !");

setcolor(15);

settextstyle(3,0,5);

/*无衬笔划字体, 水平放大5倍*/

outtextxy(120,120,"The White Win !");

setcolor(14);

settextstyle(2,0,8);

getch();

closegraph();

exit(0);

}

if(flag==2)

{

setbkcolor(BLUE);

cleardevice();

setviewport(100,100,540,380,1);

/*定义一个图形窗口*/

setfillstyle(1,2);

/*绿色以实填充*/

setcolor(YELLOW);

rectangle(0,0,439,279);

floodfill(50,50,14);

setcolor(12);

settextstyle(1,0,8);

/*三重笔划字体, 水平放大8倍*/

outtextxy(20,20,"The Red Win !");

setcolor(15);

settextstyle(3,0,5);

/*无衬笔划字体, 水平放大5倍*/

outtextxy(120,120,"The Red Win !");

setcolor(14);

settextstyle(2,0,8);

getch();

closegraph();

exit(0);

}

}

change();

break ;

}

}

else

break ;

}

}

void change()

{

if(flag==1)

flag=2 ;

else

flag=1 ;

}

void judgewho(int x,int y)

{

if(flag==1)

draw_circle(x,y,15);

if(flag==2)

draw_circle(x,y,4);

}

int judgeresult(int x,int y)

{

int j,k,n1,n2 ;

while(1)

{

n1=0 ;

n2=0 ;

/*水平向左数*/

for(j=x,k=y;j=1;j--)

{

if(box[j][k]==flag)

n1++;

else

break ;

}

/*水平向右数*/

for(j=x,k=y;j=18;j++)

{

if(box[j][k]==flag)

n2++;

else

break ;

}

if(n1+n2-1=5)

{

return(1);

break ;

}

/*垂直向上数*/

n1=0 ;

n2=0 ;

for(j=x,k=y;k=1;k--)

{

if(box[j][k]==flag)

n1++;

else

break ;

}

/*垂直向下数*/

for(j=x,k=y;k=18;k++)

{

if(box[j][k]==flag)

n2++;

else

break ;

}

if(n1+n2-1=5)

{

return(1);

break ;

}

/*向左上方数*/

n1=0 ;

n2=0 ;

for(j=x,k=y;j=1,k=1;j--,k--)

{

if(box[j][k]==flag)

n1++;

else

break ;

}

/*向右下方数*/

for(j=x,k=y;j=18,k=18;j++,k++)

{

if(box[j][k]==flag)

n2++;

else

break ;

}

if(n1+n2-1=5)

{

return(1);

break ;

}

/*向右上方数*/

n1=0 ;

n2=0 ;

for(j=x,k=y;j=18,k=1;j++,k--)

{

if(box[j][k]==flag)

n1++;

else

break ;

}

/*向左下方数*/

for(j=x,k=y;j=1,k=18;j--,k++)

{

if(box[j][k]==flag)

n2++;

else

break ;

}

if(n1+n2-1=5)

{

return(1);

break ;

}

return(0);

break ;

}

}

void main()

{

int gdriver=VGA,gmode=VGAHI;

clrscr();

attention();

initgraph(gdriver,gmode,"c:\\tc");

/* setwritemode(XOR_PUT);*/

flag=1 ;

draw_box();

do

{

step_x=0 ;

step_y=0 ;

/*draw_circle(step_x,step_y,8); */

judgewho(step_x-1,step_y-1);

do

{

while(bioskey(1)==0);

key=bioskey(0);

judgekey();

}

while(key!=SPACEkey!=ESC);

}

while(key!=ESC);

closegraph();

}

关于五子棋游戏源代码和五子棋游戏源代码电脑文本文档的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。

版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;

本文地址:http://ahzz.com.cn/post/9186.html


取消回复欢迎 发表评论:

分享到

温馨提示

下载成功了么?或者链接失效了?

联系我们反馈

立即下载