一共5346个字符,MinGW编译通过(强烈不建议写这种代码!!!)
压行规则:一行不超过80个字符
代码:
#include #include #include #define turn(x, y) (mapSize.X * (y) + (x)) #define Outside(x,y) (x < 0 || mapSize.X - 1 < x || y < 0 || mapSize.Y - 1 < y) int *map,*mark,count,bomb,firstOpen,game,bombCount,beginTime,node[8][2] = {1,0, -1,0,0,1,0,-1,-1,-1,-1,1,1,-1,1,1}; char *num[10] = { " ", "①", "②", "③", "④", "⑤", "⑥", "⑦", "⑧", "●" }; COORD size = { 18, 11 }, origin = { 0, 0 }, mapSize = { 0, 0 }, pos = { 0, 0 }; HANDLE hOut, hIn;INPUT_RECORD Buf; int *color[10] = { 0, 11, 10, 12, 14, 1, 2, 6, 4, 4 }; void gotoxy(int x,int y){COORD pos;pos.X=x;pos.Y=y;SetConsoleCursorPosition( hOut,pos);} void setScreenSize(int l,int c){COORD size={l,c};SMALL_RECT rect={0,0,size.X-1, size.Y-1};SetConsoleWindowInfo(hOut,1,&rect);SetConsoleScreenBufferSize(hOut, size);SetConsoleWindowInfo(hOut,1,&rect);} void hideCursor(){CONSOLE_CURSOR_INFO CursorInfo;GetConsoleCursorInfo(hOut,& CursorInfo);CursorInfo.bVisible=0;SetConsoleCursorInfo(hOut,&CursorInfo);} void delay(int t){static clock_t oldtime=0;while(clock()-t 0)return;for(int i=0;i <8;i++)open(x+node[i][0],y+node[i][1]);} void sign(int x,int y){if(Outside(x, y))return;int *temp=&mark[turn(x,y)];if(!* temp)return;gotoxy(x*2,y);if(*temp==1){*temp=2;SetConsoleTextAttribute(hOut,4); printf("★");bombCount--;}else{*temp=1;SetConsoleTextAttribute(hOut,15);printf(\ "■");bombCount++;}} void setBomb(int x,int y){for(int i=0,j,k;i 运行结果:


