#include <iostream>
#include "conio.h"
using namespace std;
bool gameOver;
const int width =20;
const int height=20;
int x,y,fruitx,fruity,score;
enum eDirection{STOP=0,LEFT,RIGHT,UP,DOWN};
eDirection dir;
void Setup()
{
gameOver =false;
dir=STOP;
x=width/2;
y=height/2;
fruitx=rand()%width;
fruity=rand()%height;
score=0;
}
void Draw()
{
system("clear");
for(int i=0;i<width+2;i++)
cout<<"#";
cout<<endl;
for(int i=0;i<height;i++)
{
for(int j=0;j<width;j++)
{
if(j==0)
cout<<"#";
if(i==y&&j==x)
cout<<"O";
else if(i==fruity&&j==fruitx)
cout<<"F";
else
cout<<" ";
if(j==width-1)
cout<<"#";
}
cout<<endl;
}
for(int i=0;i<width+2;i++)
cout<<"#";
cout<<endl;
}
void Input()
{
}
void Logic()
{
}
int main(int argc, char **argv)
{
Setup();
while(!gameOver)
{
Draw();
Input();
}
return 0;
}
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交