-
大小: 2.58KB文件類型: .cpp金幣: 1下載: 0 次發(fā)布日期: 2021-02-01
- 標(biāo)簽: 貪吃蛇??
資源簡(jiǎn)介
入門級(jí)示例
代碼片段和文件信息
??
#include?
#include?
#include?
#include?
#include?
#include?
#include?
using?namespace?std;?
const?int?dd[4][2]={{10}{01}{-10}{0-1}};?
char?map[33][53];?
int?dfxfyscore;?
bool?eat;?
struct?body?
{?
?int?xy;?
?body?*last*next;?
?body(){last=next=NULL;}?
}*head;?
int?Rand(int?lint?r)?
{?
?return?rand()%(r-l+1)+l;?
}?
void?init()?
{?
?for(int?i=0;i<22;i++)?
?for(int?j=0;j<52;j++)?
?map[i][j]=‘?‘;?
?for(int?i=0;i<52;i++)?
?map[0][i]=map[21][i]=‘#‘;?
?for(int?i=0;i<22;i++)?
?map[i][0]=map[i][51]=‘#‘;?
?srand((unsigned)time(NULL));?
?head=new?body;?
?head->x=Rand(515)head->y=Rand(1040);?
?d=Rand(03);?
?switch(d
- 上一篇:360新版界面源代碼
- 下一篇:俄羅斯方塊(小游戲源碼)
評(píng)論
共有 條評(píng)論