首页下载资源行业研究错误代码提问英雄哥错误代码提问英雄哥错误代码提问英雄哥

ZIP错误代码提问英雄哥错误代码提问英雄哥错误代码提问英雄哥

LeungKamwook761B需要积分:1

资源文件列表:

123.zip 大约有1个文件
  1. 123.txt 1.29KB

资源介绍:

错误代码提问英雄哥错误代码提问英雄哥错误代码提问英雄哥
#include #include using namespace std; //┗│┛┓─ ━┃ #define H 27 #define W 60 enum BlockType { EMPTY = 0, FOOD = 1, }; struct Map { BlockType data[H][W]; bool hasFood; }; struct Pos { int x; int y; }; struct Snake{ Pos snake[H * W]; int snakeDir; int sakeLength; } void initSnake(Snake* snk) { snk->sakeLength = 1; snk->snakeDir = 1; snk->snake[0] = { W / 2,H / 2 }; } void hideCursor() { HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE); CONSOLE_CURSOR_INFO curInfo = { 1,FALSE }; SetConsoleCursorInfo(hOutput, &curInfo); } void initMap(Map* map) { for (int y = 0; y < H; ++y) { for (int x = 0; x < W; ++x) { map->data[y][x] = BlockType::EMPTY; } } map->hasFood = false; } void drawMap(Map* map) { system("cls"); cout << "┏"; for (int i = 0; i < W; ++i) { cout << "━"; } cout << "┓" << endl; for (int y = 0; y < H; ++y) { cout << "┃"; for (int x = 0; x < W; ++x) { if(map->data[y][x] == BlockType::EMPTY) cout << " "; } cout << "┃" << endl; } cout << "┗" ; for (int i = 0; i < W; ++i) { cout << "━"; } cout << "┛" << endl; } int main() { Map map; initMap(&map); hideCursor(); drawMap(&map); while (1) { } return 0; }
100+评论
captcha