编程练习贪吃蛇

#include
#include
#include
#include

#define High 50
#define Width 50

//全局变量
int canvas[High][Width] = {0};
//0为空格,-1为边框■,1为蛇头□,大于一的正数为蛇身◇
void gotoxy(int x, int y)
{
	HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE); 
	COORD pos;
	pos.x = x;
	pos.y = y;
	SetConsoleCursorPosition(handle,pos);		
} 
 
 void startup()
 {
 	int i,j;
 	 //初始化边框
	for(i=0;i 1)
		       printf("◇");
		}    
	 printf("\n");
    }  	
 }
 
void updateWithoutInput()
{	
 }
void updateWithInput()
{
}

int main()
{
	startup();
	while(1)
	{
		show();
		updateWithoutInput();
		updateWithInput();		
	}
	return 0;	 
}
int moveDirection;
int canvas[High][Width] = {0};
void gotoxy(int x, int y)
{
	HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
	COORD pos;
	pos.x = x;
	pos.y = y;
	SetConsoleCursorPosition(handle,pos);
}
void moveSnakekeByDirection()
{
	int i,j;
	for(i=1;i0)
	        canvas[i][j]++;
	        
	int oldTail_i,oldTail_j,oldHead_i,

你可能感兴趣的:(c语言,学习)