国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發(fā)設(shè)計 > 正文

十全十美游戲

2019-11-17 05:32:46
字體:
供稿:網(wǎng)友
//十全十美游戲
//6*6一直到10*10,不過我只玩過6*6,其它的不知道能不能過
//按p鍵可以跳關(guān)#define Up  0x4800
#define Down  0x5000
#define P    0x1970
#define R    0x1372
#define Enter  0x1c0d
#define Esc   0x11b
#define Right  0x4d00
#define Left  0x4b00#include<bios.h>
#include<stdio.h>
#include<dos.h>
#include<graphics.h>
#include<conio.h>
#include<stdlib.h>//定義核心數(shù)據(jù)
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];  //記錄小方格的狀態(tài),用'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.nowy<LargeStarty)  {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.nowy>LargeStarty+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.nowx<LargeStartx)  {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.nowx>LargeStartx+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(array<10)  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;i<5;i++)
     ChargeColor(i);
        break;
        }
      case Esc:
        {
        closegraph();
        exit(1);
                      }
      }
   if(Win())
       {
       outtextxy(100,50,"CONGRATULATIONS!");
       sleep(5);
       setbkcolor(BLUE);
              cleardevice();
              if(array<10)  array++;
       else array=5;
 


上一篇:實現(xiàn)Cookie

下一篇:使用Sockets

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 泰和县| 信宜市| 营口市| 济源市| 华宁县| 茶陵县| 宜宾市| 永平县| 苍溪县| 海淀区| 濉溪县| 柘城县| 深圳市| 余姚市| 高青县| 象州县| 灌南县| 新郑市| 泽库县| 连山| 平度市| 新津县| 正宁县| 大名县| 景东| 河曲县| 齐齐哈尔市| 伊金霍洛旗| 临沭县| 西吉县| 阿坝| 南和县| 娱乐| 喀喇| 西乌| 庐江县| 仪陇县| 南江县| 阳新县| 西和县| 拉萨市|