#include
#include
#define __CPPARGS ... #else
#define __CPPARGS #endif
#define MINBOXSIZE 15 /* ×îС·½¿éµÄ³ß´ç */ #define BGCOLOR 7 /* ±³¾°×ÅÉ« */
#define GX 200 #define GY 10
#define SJNUM 10000 /* ÿµ±Íæ¼Ò´òµ½Ò»Íò·ÖµÈ¼¶¼ÓÒ»¼¶*/ /* °´¼üÂë*/
#define VK_LEFT 0x4b00 #define VK_RIGHT 0x4d00 #define VK_DOWN 0x5000 #define VK_UP 0x4800
#define VK_HOME 0x4700 #define VK_END 0x4f00 #define VK_SPACE 0x3920 #define VK_ESC 0x011b #define VK_ENTER 0x1c0d
/* ¶¨Òå¶íÂÞ˹·½¿éµÄ·½Ïò£¨ÎÒ¶¨ÒåËûΪ4ÖÖ£©*/ #define F_DONG 0 #define F_NAN 1 #define F_XI 2 #define F_BEI 3
#define NEXTCOL 20 /* Òª³öµÄÏÂÒ»¸ö·½¿éµÄ×Ý×ø±ê*/ #define NEXTROW 12 /* Òª³öµÄÏÂÒ»¸ö·½¿éµÄºá´Ó±ê*/ #define MAXROW 14 /* ÓÎÏ·ÆÁÄ»´óС*/
#define MAXCOL 20
#define SCCOL 100 /*ÓÎÏ·ÆÁÄ»´óÏÔʾÆ÷ÉϵÄÏà¶ÔλÖÃ*/ #define SCROW 60
int gril[22][16]; /* ÓÎÏ·ÆÁÄ»×ø±ê*/
int col=1,row=7; /* µ±Ç°·½¿éµÄºá×Ý×ø±ê*/
int boxfx=0,boxgs=0; /* µ±Ç°Ë¿éµÄÐÎ׳ºÍ·½Ïò*/
int nextboxfx=0,nextboxgs=0,maxcol=22;/*ÏÂÒ»¸ö·½¿éµÄÐÎ׳ºÍ·½Ïò*/ int minboxcolor=6,nextminboxcolor=6; int num=0; /*ÓÎÏ··Ö*/
int dj=0,gamedj[10]={18,16,14,12,10,8,6,4,2,1};/* ÓÎÏ·µÈ¼¶*/ /* ÒÔÏÂÎÒÓÃÁËÒ»¸ö3άÊý×éÀ´¼Í¼·½¿éµ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Ãµ½µ±Ç°·½¿éºÍÏÂÒ»¸ö·½¿éµÄÐÎ×´ºÍ·½Ïò*/ void boxrad(){
minboxcolor=nextminboxcolor; boxgs=nextboxgs; boxfx=nextboxfx;
nextminboxcolor=random(14)+1;
if(nextminboxcolor==4||nextminboxcolor==7||nextminboxcolor==8) nextminboxcolor=9; nextboxfx=F_DONG; nextboxgs=random(7); }
/*³õʼ»¯Í¼ÐÎÄ£ÊÔ*/
void init(int gdrive,int gmode){ int errorcode;
initgraph(&gdrive,&gmode,\
errorcode=graphresult(); if(errorcode!=grOk){
printf(\ exit(1); } }
/* ÔÚͼÐÎģʽϵÄÇåÆÁ */ void cls() {
setfillstyle(SOLID_FILL,0); setcolor(0);
bar(0,0,640,480); }
/*ÔÚͼÐÎģʽϵĸ߼¶ÇåÆÁ*/
void clscr(int a,int b,int c,int d,int color){ setfillstyle(SOLID_FILL,color); setcolor(color); bar(a,b,c,d);