十全十美游戏
在这个颜值当道,屌丝闪边的时代,拼不过颜值拼内涵,只有知识丰富才能提升一个人的内在气质和修养,所谓人丑就要多学习,今天图老师给大家分享十全十美游戏,希望可以对大家能有小小的帮助。
//6*6一直到10*10,不过我只玩过6*6,其它的不知道能不能过
//按p键可以跳关#define Up 0x4800
#define Down 0x5000
#define P 0x1970
#define R 0x1372
#define Enter 0x1c0d
#define Esc 0x11b
#define Right 0x4d00
#define Left 0x4b00#includebios.h
#includestdio.h
#includedos.h
#includegraphics.h
#includeconio.h
#includestdlib.h//定义核心数据
int LargeStartx;
int LargeStarty; //大方格的起始位置
int SmallStartx;
int SmallStarty; //小方格的起始位置int array=5; //行列式的大小
int position; //方格的位置用0-array*array-1表示typedef strUCt rect2 //定义大方格的属性即移动方格的属性
{
int nowx;
int nowy;
int agox;
int agoy;
int size;//40
char color;
}Large;
Large LargeRect;
char Attr[10*10]; //记录小方格的状态,用'W'(white)与'R'(red)表示。typedef struct add //用于改变小方格颜色时,五个方向的增加量(包括当前位置)
{
int x;
int y;
int p;
}Add; typedef struct rect1 //记录小方格的当前位置=大方格的当前位置-(大方格的大小-小方格的大小)/2,x轴与y轴一样
{
int nowx;
int nowy;
int size; //20
char color;
}Small;
Small SmallRect;void ChargeColor(int );
void InitData1();
void InitData2();
void DrawLargeRect(int ,int ,int ,char );
void DrawSmallRect(int ,int ,int ,char );
void InitPic();
int Win();
int Judge(int ,int );
void main()
{
int key;
int gdriver=DETECT, gmode;
registerbgidriver(EGAVGA_driver);
initgraph(&gdriver, &gmode, "");
setbkcolor(BLUE);
cleardevice();
InitData1();
InitData2();
InitPic();
do
{
key=bioskey(0);
LargeRect.agox=LargeRect.nowx;
LargeRect.agoy=LargeRect.nowy;
switch(key)
{
case Up:
{
LargeRect.nowy-=LargeRect.size;
if(LargeRect.nowyLargeStarty) {LargeRect.nowy+=LargeRect.size;continue;}
setwritemode(1);
DrawLargeRect(LargeRect.agox,LargeRect.agoy,LargeRect.size,LargeRect.color);
DrawLargeRect(LargeRect.nowx,LargeRect.nowy,LargeRect.size,LargeRect.color);
setwritemode(0);
position-=array;
break;
}
case Down:
{
LargeRect.nowy+=LargeRect.size;
if(LargeRect.nowyLargeStarty+LargeRect.size*(array-1)) {LargeRect.nowy-=LargeRect.size;continue;}
setwritemode(1);
DrawLargeRect(LargeRect.agox,LargeRect.agoy,LargeRect.size,LargeRect.color);
DrawLargeRect(LargeRect.nowx,LargeRect.nowy,LargeRect.size,LargeRect.color);
setwritemode(0);
position+=array;
break;
}
case Left:
{
LargeRect.nowx-=LargeRect.size;
if(LargeRect.nowxLargeStartx) {LargeRect.nowx+=LargeRect.size;continue;}
setwritemode(1);
DrawLargeRect(LargeRect.agox,LargeRect.agoy,LargeRect.size,LargeRect.color);
DrawLargeRect(LargeRect.nowx,LargeRect.nowy,LargeRect.size,LargeRect.color);
setwritemode(0);
position-=1;
break;
}
case Right:
{
LargeRect.nowx+=LargeRect.size;
if(LargeRect.nowxLargeStartx+LargeRect.size*(array-1)) {LargeRect.nowx-=LargeRect.size;continue;}
setwritemode(1);
DrawLargeRect(LargeRect.agox,LargeRect.agoy,LargeRect.size,LargeRect.color);
DrawLargeRect(LargeRect.nowx,LargeRect.nowy,LargeRect.size,LargeRect.color);
setwritemode(0);
position+=1;
break;
}
case P:
{
setbkcolor(BLUE);
cleardevice();
if(array10) array++;
else array=5;
InitData2();
InitPic();
break;
}
case R:
{
setbkcolor(BLUE);
cleardevice();
InitData2();
InitPic();
break;
}
case Enter:
{
SmallRect.nowx=LargeRect.nowx+10;
SmallRect.nowy=LargeRect.nowy+10;
for(int i=0;i5;i++)
ChargeColor(i);
break;
}
case Esc:
{
closegraph();
exit(1);
}
}
if(Win())
{
outtextxy(100,50,"CONGRATULATIONS!");
sleep(5);
setbkcolor(BLUE);
cleardevice();
if(array10) array++;
else array=5;