NO 1 源代码 (最后一章时有彩蛋务必观看)
#include<bits/stdc++.h>
#include <cstdio>
#include <conio.h>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <windows.h>
#include <algorithm>
#include<sys/time.h>
#define REP(i,a,b) for (int i=(a);i<=(b);i++)
#define PER(i,a,b) for (int i=(a);i>=(b);i--)
#define max(x,y) ((x)<(y)?(y):(x))
#define min(y,x) ((x)<(y)?(x):(y))
#define MEM(a,b) memset(a,(b),sizeof(a))
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)//判断这个键是否按下
#define KEY_UP(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 0 : 1)//判断这个键是否弹起
#define KEY_EVERY(lpkeyState) GetKeyboardState(lpKeyState)//获得所有的256个键(键盘按键、鼠标按键等等)的状态,lpKeyState是指向一个256bit的数组,存放所有键的状态。
#define KEY_NOW(nVirtKey) GetKeyState(nVirtKey)//用于判断nVirtKey的状态。用返回值的最高位表示,最高位为1表示当前键处于down的状态;最高位为0当前键处于up状态。此函数从消息队列中读取消息进行处理。
#define setcolor(x) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),x)//设置颜色
#define getkey(x) GetAsyncKeyState(x)
#define GetWindow() GetForegroundWindow();//得到窗口信息
#define Nor if(B[b].x<5) B[b].x=5;
#define Out1 Bx1-Bvx1<=6||Bx1-Bvx1>=28||By1-Bvy1<=7||By1-Bvy1>=27
#define Out2 Bx2-Bvx2<=6||Bx2-Bvx2>=28||By2-Bvy2<=7||By2-Bvy2>=27
#define Chang1 {Bwhat1=0;Bvx1=Bvy1=0;memset(Bgo1,0,sizeof(Bgo1));}
#define Chang2 {Bwhat2=0;Bvx2=Bvy2=0;memset(Bgo2,0,sizeof(Bgo2));}
#define Chang3 {Bwhat3=0;Bvx3=Bvy3=0;memset(Bgo3,0,sizeof(Bgo3));}
#define MAXIMUS 15 //定义棋盘大小
int cs[8],dh[8],b[15],i[10],dg[8],bf[4],hh[10],j[9],ys1[20],ys2[20],zbcc[20],zbsx[20],yszb[20],drcf[8],cfzb[20],lb[20];
int daojvsx[11],daojvcc[11],cfdaojv[11],daojvlb[2];
using namespace std;
int brand();
void GOTO(int x,int y);
int brand(){return (rand()<<16)|(rand()<<1)|(rand()&1);}
void bsrand(){srand(GetTickCount());}
void cls(){system("cls");}
void retr(){//退出程序
system("cls");
return;
}
void Window_Hide(HWND hWnd){ShowWindow(hWnd,0);}//隐藏窗口
void Window_Show(HWND hWnd){ShowWindow(hWnd,1);}//显示窗口
int getmouse_y(){//获取鼠标在屏幕中x的位置
POINT pt;
GetCursorPos(&pt);
return pt.x;
}
int getmouse_x(){//获取鼠标在屏幕中y的位置
POINT pt;
GetCursorPos(&pt);
return pt.y;
}
void setmouse(int y,int x){SetCursorPos(x,y);}//设置鼠标在屏幕中的位置
void click_left(){//鼠标左键点击
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
Sleep(5);//要留给某些应用的反应时间
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
}
void click_right(){//鼠标右键点击
mouse_event(MOUSEEVENTF_RIGHTDOWN,0,0,0,0);
Sleep(5);
mouse_event(MOUSEEVENTF_RIGHTUP,0,0,0,0);
}
void GOTO(int x,int y){//将光标移动到屏幕中的位置
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
HANDLE hConsoleOut;
hConsoleOut = GetStdHandle(STD_OUTPUT_HANDLE);
GetConsoleScreenBufferInfo(hConsoleOut,&csbiInfo);
csbiInfo.dwCursorPosition.Y = x;
csbiInfo.dwCursorPosition.X = y;
SetConsoleCursorPosition(hConsoleOut,csbiInfo.dwCursorPosition);
}
const int flg[4][2]={{1,0},{0,2},{0,-2},{-1,0}};
int n=28,m=76,tim;
struct xcw{int x,y;}ty[5][1000005],foodd[2];
int tot[5],f[5],score,food,ground=0,ms,ans_len=1e9;
bool vis[1005][1005];
void ret();
void result();
bool check();
void fnd();
void rand_food();
void draw();
int choose();
void stop();
int mods();
int ads();
int get_food();
int other();
void machine();
int change();
int main();
……自行阅读,代码太太长,64赞出注释。