;n;
for(i=0;ilt;定义棋盘
for(i=0;
if(timeover)
{
getch();//
int head=3 ;y=zuobiao[1][head];
if(direction==80)
x=zuobiao[0][head]+1;初始化棋盘
for(i=0;ilt;;
tail=(tail+1)%80;).h;
includelt;conio.h;zuobiao[1][tail]=1;zuobiao[0][1]=1;zuobiao[1][1]=2;zuobiao[0][2]=1;zuobiao[1][2]=3;zuobiao[0][head]=1;
direction=getch();
}
else
direction=direction;
if(!(direction==72direction==80direction==75direction==77))
{
return 0;
system(cls);20;i++)/y=zuobiao[1][head];
if(direction==75)
x=zuobiao[0][head];
includelt;
printf()
return 0;
qipan[zuobiao[0][tail]][zuobiao[1][tail]]=,在所有c语言的编译器(vc++6.0、turbo…………)上都能运行,你还可以进一步改进。这是一个类似贪吃蛇的小游戏。祝运*/
/
for(i=0;ilt;n);
scanf(初始化蛇的位置
qipan[1][4]=;
zuobiao[0][tail]=1,char direction)
{
int x,y;
if(direction==72)
x=zuobiao[0][head]-1;y=zuobiao[1][head]+1;
if(x==0x==18y==78y==0)
return 0;
if(qipan[x][y];*贪吃蛇*/%d .h;
includelt;time;n);
printf(Input your game speed,please;
char qipan[20][80];/打印出棋盘
for(j=0;jlt;q;;ilt;20;
int timeover;;
for(i=0;ilt;
}
}
return 0;
}
int change(char qipan[20][80],int zuobiao[2][80];
start=clock(););y=zuobiao[0][head]-1;
if(direction==77)
x=zuobiao[0][head];,zuobiao;
printf(i++)
qipan[i][0]=;80;j++)
qipan[i][j]=; ;;
while(!kbhit()(timeover=clock()-startlt;=gamespeed));
for(i=0;
qipan[zuobiao[0][head]][zuobiao[1][head]]=;*;;//
includelt,tail=0;
int main()
{
int i,j,k=0;
int zuobiao[2][80];
long start;
int direction=77;
int gamespeed; ;zuobiao[1][head]=4;
/*处理棋盘*,char direction);
zuobiao[1][head]=y;
qipan[zuobiao[0][head]][zuobiao[1][head]]=;);stdio,direction))
{
direction=,刚接触编程语言;i++)
for(j=0;jlt;;
return 1;20;i++)
qipan[i][79]=,qipan[i][j]);
timeover=1;80;j++)
printf(%c;;
system(cls,gamespeed);
while(direction!=;q;)
{
system(cls;
printf(This is a game of a SNAKE.;);nGOOD LUCK TO YOU !;ilt;20;_!=;
int change(char qipan[20][80],int zuobiao[2][80],以下是我自己变得一个小程序;;80;i++)
qipan[19][i]=;GAME OVER;*也不知道你是什么级别的,我是一个新手;;//stdlib.h;
head=(head+1)%80;
zuobiao[0][head]=x!;n80;i++)
qipan[0][i]=;_;;GAME OVER.(e.g.300);
}
if(!change(qipan;;
qipan[1][1]=qipan[1][2]=qipan[1][3]=;*;