嵌入式系统课程设计报告贪吃蛇Word文档格式.docx
《嵌入式系统课程设计报告贪吃蛇Word文档格式.docx》由会员分享,可在线阅读,更多相关《嵌入式系统课程设计报告贪吃蛇Word文档格式.docx(29页珍藏版)》请在冰豆网上搜索。
************************************************************************************************************
*/
#include"
..\inc\config.h"
#include<
stdlib.h>
time.h>
stdio.h>
#defineSTACKSIZE256
OS_STK_DATAstk;
externGUI_FONTCHINESE_FONT12;
externGUI_FONTCHINESE_FONT16;
externGUI_FONTGUI_Font8x16;
OS_EVENT*Key_Mbox;
/*
*************************************************************************************************************
**分配各任务的堆栈容量**
OS_STKStack_Task_1[STACKSIZE];
OS_STKStack_Task_2[STACKSIZE];
OS_STKStack_Task_3[STACKSIZE];
OS_STKStack_Task_4[STACKSIZE*3];
/************************************************************************************************************/
#defineMAX_X200//蛇的最大长度
#defineMAX_Y200
#defineUP1//蛇的方向
#defineDOWN2
#defineLEFT3
#defineRIGHT4
#defineROW22//表格行数
#defineCOLUMN22//表格列数
//定义蛇的各项信息
structSnake
{
S32x[MAX_X];
S32y[MAX_Y];
S32length;
S32direction;
S32life;
}snake;
structFood
{
intx;
/*食物的横坐标*/
inty;
/*食物的纵坐标*/
intyes;
/*判断是否要出现食物的变量*/
}food;
/*食物的结构体*/
S16map_1[22][22]={//{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21}
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},//0
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},//1
{0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0},//2
{0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0},//3
{0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0},//4
{0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0},//5
{0,0,1,0,0,0,0,0,0,0,0,0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