每日收获2019.7.11

今天是公元二O一九年七月十一日,星期四。今天的收获如下:
数学学了分数和小数的比较,分数:分子相同分母大,分数小,分母相同分子大,分数大.真分数,分母分子差1,分母大,分数大,分子分母差相等,分子大,分数大。小数数位对齐。
语文讲了仿句。
英语看了PET part3,还背了如下单词
departure disadvantage refund dessert couple souvenir shop economics edge courage diary

贪吃蛇(1+2)可能有错,希望大家指出

#include

/* run this program using the console pauser or add your own getch, system(“pause”) or input loop */
#include<stdlib.h>
#include
#include
#include<windows.h>
#include<conio.h>
#define UP 1
#define DOWN 2
#define LEFT 3
#define RIGHT 4
#define MAP_HEIGHT 30
#define MAP_WIDTH 40
using namespace std;
int speed = 0:
void GotoXY(int x,int y){
COORD pos;
pos.X=x;
pos.Y=y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}
typedef struct
{
int x;
int y;
}COORDINATE;

class GameSet{
pubic:
static void Gamelnit(){
system(“mode con cols=80 line=40”);
HANDLE handle=GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_CURSOR_INFO Cursorlnfo;
GetConsoleCursorlnfo(handle,&Cursorlnfo);
Cursorlnfo.bVisible=false;
SetConsoleCursorlnfo(handie,&Cursorlnfo);
srand((unsigned int)time(0))
}
};
class PrintUI{
public:
static void DrawMap(){
system(“cls”);
int i,j;
for(i=0;i<MAP_WIDTH;i++){
cout << “";
}
cout << endl;
for(i=0;i<MAP_HEIGHT;i++){
cout << "
”;
for(j=0;j<MAP_WIDTH-2;j++){
cout << “”;
}
cout<<""<<endl;
}
for(i=0;i<MAP_WIDTH;i++){
cout << "
";
}
}
static void GameOver(int score){
GotoXY(MAP_WIDTH + 3,3);
cout << “GAME OVER”<<endl;
GotoXY(MAP_WIDTH + 3,5);
cout << “YOUR SCORE IS”<<score<<endl;
}
static void (int score){
GotoXY(MAP_WIDTH + 3,5);
cout << “YOUR SCORE IS”<<score<<endl;
GotoXY(MAP_WIDTH + 3,8);
cout << “NOW SPEED IS”,<< 10- speed / 25<<endl;
}
};
class Food{
private:
COORDINATE food_position;
public:
void RandomXY(vector&snake_position)
{
food_position.x = rand() % (MAP_WEIDTH - 2) + 1;
food_position.y = rand() % (MAP_HEIGHT - 2) + 1;
unsigned int i;
for (i=0;i < snake_position size()i++)
{
if (snake _position[i].x == food_position.x && snake _position[i].y == food_position.y )
{
food_position.x = rand() % (MAP_WEIDTH - 2) + 1;
food_position.y = rand() % (MAP_HEIGHT - 2) + 1;
i = 0;
}
}
}
Food(){

}
Food(vector<COORDINATE> &snake_position){
	RandomXY(snake_position);
}
void DrawFood(){
	GotoXY(food_position.x, food_position.y);
    cout <<"@";
}
COORDINATE GetFoodPosition(){
	return food_position
}

};
class Snake{

private:
bool snake_alive;
int my_direction;
public:
vectorsnake_position;
Snake(){
snake_alive = true;
my_direction = 1;
COORDINATE snake_head;
snake_head.x = MAP_WIDTH / 2;
snake_head.y = MAP_HEIGHT / 2;
this->snake_position.push_back(snake_head)
this->snake_position.push_back(snake_head)
this->snake_position.push_back(snake_head)
this->snake_position.push_back(snake_head)
this->snake_position.push_back(snake_head)
}
void ListenKeyBoard(){
char ch;
if(kb_kbhit()){
ch = _getch();
switch (ch){
case"w":
if(this->my_direction == DOWN)
break;
this->my_direction = UP;
break;
case"s":
if(this->my_direction == UP)
break;
this->my_direction = DOWN;
break;
case"a":
if(this->my_direction == RIGHT)
break;
this->my_direction = LEFT;
break;
case"d":
if(this->my_direction == LEFT)
break;
this->my_direction = RIGHT;
break;

		case ']'
				if(speed < 250){
					speed += 25;
				}
			    break;
		    }
		}
   }

};

int main() {

return 0;

}

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值