C++實用程式設計——坦克大戰小遊戲

小笨笨qaq發表於2019-01-01

我們直接看程式碼吧,適於win XP和win 7,win 10 畫質有些毒瘤



#include <stdio.h>

#include <windows.h>

#include <time.h> 

                           //裡規格:長39*2=78 (真座標)(假座標寬為39)  高39

                           //外規格:長41*2=82 (真座標)(假座標寬為41)  高41

#define UP    1

#define DOWN  2

#define LEFT  3

#define RIGHT 4

#define MAX_LEVEL 8

#define BULLET_NUM 20

#define MAX_LIFE 4

 

//程式中未寫入函式參數列中且未說明的變數只有map二維陣列,level_info陣列和level   

 

/*

      此程式中涉及的x,y類的座標值,分為以下兩種:                                 

                                                                                                  

假座標:這裡的座標指的是以一個■長度為單位的座標,而不是真正的coord座標 (用於map陣列的座標)                             

                                                                                                  

真座標:標頭檔案自帶的座標結構coord中的座標(也可以說是控制檯裡的真正座標值)                                 

                                                                                                  

  區別:縱座標y兩值一致,假橫座標x值與真正coord橫座標(真座標)關係是 x * 2 = coord 橫座標    

                                                                                                            

          coord橫座標既指GoTo函式中的x引數,因為本程式遊戲介面以一個■長度為基本單位,                    

                                                                                                  

          可以說涉及的coord橫座標全是偶數。既假座標要變真座標(變真座標才能發揮真正作用),橫座標須乘以2                                    



                                                           

*/

typedef struct             //這裡的出現次序指的是一個AI_tank變數中的次序,遊戲共有四個AI_tank變數

{                          //∵設定每個AI_tank每種特殊坦克只出現一次 ∴fast_tank & firm_tank 最多出現次數不超過1

    int fast_tank_order;   //fast_tank出現的次序(在第fast_tank_order次復活出現,從第0次開始),且每個AI_tank只出現一次

    int firm_tank_order;   //firm_tank出現的次序,同上

} LevInfo;                 //關卡資訊(準確說是該關出現的坦克資訊)

LevInfo level_info [MAX_LEVEL] = {{-1,-1},{3,-1},{-1,3},{2,3},{2,3},{2,3},{2,3},{2,3}};   //初始化,-1代表沒有該型別坦克

 

 

typedef struct      //子彈結構體

{

    int x,y;        //子彈座標,假座標

    int direction;  //子彈方向變數

    bool exist;     //子彈存在與否的變數,1為存在,0不存在

    bool initial;   //子彈是否處於建立初狀態的值,1為處於建立初狀態,0為處於非建立初狀態

    bool my;        //區分AI子彈與玩家子彈的標記,0為AI子彈,1為玩家(我的)子彈

} Bullet;

Bullet bullet [BULLET_NUM];  //考慮到地圖上不太可能同時存在20顆子彈,所以陣列元素設定20個

 

 

typedef struct      //坦克結構體

{

    int x,y;        //坦克中心座標

    int direction;  //坦克方向

    int color;      //顏色參方向數,1到6分別代表不同顏色,具體在PrintTank函式定義有說明

    int model;      //坦克圖案模型,值為1,2,3,分別代表不同的坦克圖案,0為我的坦克圖案,AI不能使用

    int stop;       //只能是AI坦克使用的引數,非0代表坦克停止走動,0為可以走動

    int revive;     //坦克復活次數

    int num;        //AI坦克編號(固定值,為常量,初始化函式中定下)0~3

    int CD;         //發射子彈冷卻計時

    bool my;        //是否敵方坦克引數,我的坦克此引數為1,為常量

    bool alive;     //存活為1,不存活為0

}  Tank;

Tank AI_tank[4] , my_tank;  //my_tank為我的坦克,Ai_tank 代表AI坦克

 

//∵所有的函式都有可能對全域性變數map進行讀寫(改變),

//∴函式中不另說明是否會對全域性變數map讀寫

//基本操作與遊戲輔助函式

void GoToxy(int x,int y);    //游標移動

void HideCursor();           //隱藏游標

void keyboard ();            //接受鍵盤輸入

void Initialize();           //初始化(含有對多個資料的讀寫)

void Stop();                 //暫停

void Getmap();               //地圖資料存放與獲取

void Frame ();               //列印遊戲主體框架

void PrintMap();             //列印地圖(地圖既地圖障礙物)(含對level的讀取)

void SideScreen ();          //副螢幕列印

void GameCheak();            //檢測遊戲輸贏

void GameOver( bool home );  //遊戲結束

void ClearMainScreen();      //主螢幕清屏函式∵system("cls")後列印框架有一定機率造成框架上移一行的錯誤∴單獨編寫清屏函式

void ColorChoose(int color); //顏色選擇函式

void NextLevel();            //下一關(含有對level全域性變數的讀寫)

 

//子彈部分

void BuildAIBullet(Tank *tank);                //AI坦克發射子彈(含有對my_tank的讀取,只讀取了my_tank座標)

void BuildBullet  (Tank tank);                 //子彈發射(建立)(人機共用)(含全域性變數bullet的修改)我的坦克發射子彈直接呼叫該函式,AI通過AIshoot間接呼叫

void BulletFly    (Bullet bullet[BULLET_NUM]); //子彈移動和打擊(人機共用),

void BulletHit    (Bullet* bullet);            //子彈碰撞(人機共用)(含Tank全域性變數的修改),只通過BulletFly呼叫,子彈間的碰撞不在本函式,子彈間碰撞已在BulletShoot中檢測並處理

void PrintBullet  (int x,int y,int T);         //列印子彈(人機共用)

void ClearBullet  (int x,int y,int T);         //清除子彈(人機共用)

int  BulletCheak  (int x,int y);               //判斷子彈前方情況(人機共用)

 

//坦克部分

void BuildAITank (int* position, Tank* AI_tank); //建立AI坦克

void BuildMyTank (Tank* my_tank);                //建立我的坦克

void MoveAITank  (Tank* AI_tank);                //AI坦克移動

void MoveMyTank  (int turn);                     //我的坦克移動,只通過keyboard函式呼叫,既鍵盤控制

void ClearTank   (int x,int y);                  //清除坦克(人機共用)

void PrintTank   (Tank tank);                    //列印坦克(人機共用)

bool TankCheak   (Tank tank,int direction);      //檢測坦克dirtection方向的障礙物,返值1阻礙,0 暢通

int  AIPositionCheak (int position);           //檢測AI坦克建立位置是否有障礙物AIPositionCheak

 

//DWORD WINAPI InputX(LPVOID lpParameter); //宣告執行緒函式,用於檢查X鍵輸入並設定X鍵的輸入冷卻時間

 

 

//注意map陣列應是縱座標在前,橫座標在後,既map[y][x],(∵陣列行長度在前,列長度在後)

//map裡的值: 個位數的值為地圖方塊部分,百位數的值為坦克,子彈在map上沒有值(子彈僅僅是一個假座標)

//map裡的值: 0為可通過陸地,1為紅磚,2黃磚,5為水,100~103為敵方坦克,200為我的坦克,

 

//全域性變數

int map[41][41];  //地圖二維陣列

int key_x;        // X鍵是否被“讀入”的變數,也是子彈是否可以發射的變,

int bul_num;      //子彈編號

int position;     //位置計數,對應AI坦克生成位置,-1為左位置,0為中間,1為右,2為我的坦克位置

int speed=7;      //遊戲速度,調整用

int level=1;      //遊戲關卡數

int score=0;      //遊戲分數

int remain_enemy; //剩餘敵人(未出現的敵人)

 

char* tank_figure[4][3][4]=

{

  {

    {"◢┃◣", "◢━◣", "◢┳◣", "◢┳◣"},

    {"┣●┫", "┣●┫", "━●┃", "┃●━"},

    {"◥━◤", "◥┃◤", "◥┻◤", "◥┻◤"}

  }, 

  {

    {"┏┃┓", "┏┳┓", "┏┳┓", "┏┳┓"},

    {"┣●┫", "┣●┫", "━●┫", "┣●━"},

    {"┗┻┛", "┗┃┛", "┗┻┛", "┗┻┛"}

  }, 

  {

    {"┏┃┓", "◢━◣", "┏┳◣", "◢┳┓"},

    {"┣●┫", "┣●┫", "━●┃", "┃●━"},

    {"◥━◤", "┗┃┛", "┗┻◤", "◥┻┛"}

  },

  {

    {"╔┃╗", "╔╦╗", "╔╦╗", "╔╦╗"},

    {"╠█╣", "╠█╣", "━█╣", "╠█━"},

    {"╚╩╝", "╚┃╝", "╚╩╝", "╚╩╝"}

  }

};

 

 

 

int main ()                               //主函式

{

    int i;

    unsigned int interval[12]={1,1,1,1,1,1,1,1,1,1,1,1} ;  //間隔計數器陣列,用於控制速度

    srand(time(NULL)); //設定隨機數種子(若不設定種子而呼叫rand會使每次執行的隨機數序列一致)隨機數序列指:如首次呼叫rand得到1,第二次得2,第三次3,則此次隨機數序列為1,2,3

    HideCursor();                         //隱藏游標

    system("mode con cols=112 lines=42"); //控制視窗大小

    Frame ();                             //列印遊戲主體框架

    Initialize();                         //初始化,全域性變數level初值便是1 

//    HANDLE h1 , h2 ;                      //定義控制程式碼變數

    for(;;)

    {

        if(interval[0]++%speed==0)        //速度調整用,假設interval[0]為a, 語句意為 a % 2==0,a=a+1; 

        {

            GameCheak();                  //遊戲勝負檢測

            BulletFly ( bullet );

            for(i=0 ; i<=3 ; i++)         //AI坦克移動迴圈

            {

                if(AI_tank[i].model==2 && interval[i+1]++%2==0) //四個坦克中的快速坦克單獨使用計數器1,2,3,4

                    MoveAITank( & AI_tank[i]);

                if(AI_tank[i].model!=2 && interval[i+5]++%3==0) //四個坦克中的慢速坦克單獨使用計數器5,6,7,8

                    MoveAITank( & AI_tank[i]);

            }

            for(i=0;i<=3;i++)                                   //建立AI坦克部分

                     if(AI_tank[i].alive==0 && AI_tank[i].revive<4 && interval[9]++%90==0)  //一個敵方坦克每局只有4條命

                {                                               //如果坦克不存活。計時,每次建立有間隔  1750 ms

                       BuildAITank( &position, & AI_tank[i] );     //建立AI坦克(復活)

                      break;                                      //每次迴圈只建立一個坦克

                  }

            for(i=0;i<=3;i++)

                if(AI_tank[i].alive)

                    BuildAIBullet(&AI_tank[i]);                 //AIshoot自帶int自增計數CD,不使用main中的CD interval

            if(my_tank.alive && interval[10]++%2==0 )

                 keyboard ();

            if(my_tank.alive==0 && interval[11]++%30==0 && my_tank.revive < MAX_LIFE)

                 BuildMyTank( &my_tank );

        }

        Sleep(5);

    }

    return 0;

}

 

 

/*//這裡的多執行緒暫時不用                   //x鍵用於子彈發射,x鍵的冷卻時間不能和上下左右一同設定,那樣就太快了

DWORD WINAPI InputX(LPVOID lpParameter)    //如果不用多執行緒執行,那麼在x鍵冷卻時間內程式會因Sleep將會掛起,暫停執行

{                                          //因為只有一個變數改變,而且變數改變先後順序是顯而易見的,所以不必設定緩衝區

    for(;;)                              

    {                                    

        if(GetAsyncKeyState( 88 )& 0x8000) //88為x鍵鍵值,當摁下x並且x鍵處於可輸入狀態

        {

            key_x=1;                       // X鍵是否允許被“讀入”的變數,也是子彈是否可以發射的變數

            Sleep(600);                    // 子執行緒Sleep中,x就不能被"讀入",主執行緒每操作完一次子彈發射,key_x會歸零

        }

        Sleep(10);

    }

    return 0;

}*/

 

 

void keyboard ()

{               // kbhit()   getch()  用法可用但是不好用            

/* 

   函式功能:該函式判斷在此函式被呼叫時,某個鍵是處於UP狀態還是處於DOWN狀態,及前次呼叫GetAsyncKeyState函式後,

   是否按過此鍵.如果返回值的最高位被置位,那麼該鍵處於DOWN狀態;如果最低位被置位,那麼在前一次呼叫此函式後,此鍵被按過,

   否則表示該鍵沒被按過.

   這裡GetAsyncKeyState比 kbhit() + getch() 好用,操作更順暢.   GetAsyncKeyState的返回值表示兩個內容,

   一個是最高位bit的值,代表這個鍵是否被按下。一個是最低位bit的值,代表上次呼叫GetAsyncKeyState後,這個鍵是否被按下。

   &為與操作,&0x8000就是判斷這個返回值的高位位元組。如果high-order bit是1,則是按下狀態,否則是彈起狀態,為0

*/

    int count=0;

    if (GetAsyncKeyState(VK_UP)& 0x8000)  

        MoveMyTank( UP );

    else if (GetAsyncKeyState(VK_DOWN)& 0x8000)  

        MoveMyTank( DOWN );

    else if (GetAsyncKeyState(VK_LEFT)& 0x8000)

        MoveMyTank( LEFT );

    else if (GetAsyncKeyState(VK_RIGHT)& 0x8000)  

        MoveMyTank( RIGHT );

    else if (GetAsyncKeyState( 0x1B )& 0x8000)  // Esc鍵

        exit(0);                                //退出程式函式

    else if (GetAsyncKeyState( 0x20 )& 0x8000)  //空格

        Stop();

    else if (count++%7==0)            //這裡新增計數器是為了防止按鍵粘連不能達到微調效果

    {

        if (speed>1 && GetAsyncKeyState( 0x6B )& 0x8000)   // +鍵

        {

            speed--;

            GoToxy(102,11);           //在副螢幕列印出當前速度

            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE|FOREGROUND_RED);

            printf("%d ",21-speed);   //副螢幕顯示的速度為1~10

        }

        else if (speed<20 && GetAsyncKeyState( 0x6D )& 0x8000)  // - 鍵

        {

            speed++;

            GoToxy(102,11);           //在副螢幕列印出當前速度

            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE|FOREGROUND_RED);

            printf("%d ",21-speed);   //副螢幕顯示的速度為1~10

        }

    }

    if(my_tank.CD==7)

    {

        if(GetAsyncKeyState( 88 )& 0x8000)

        {

            BuildBullet(my_tank);

            my_tank.CD=0;

        }

    }

    else

        my_tank.CD++;

}

 

 

 

void BuildAIBullet(Tank *tank)   //AI子彈發射(建立)含有對my_tank的讀取

{

    if(tank->CD==15)

    {

        if(!(rand()%11))     //冷卻結束後在隨後的每個遊戲週期中有10分之一的可能發射子彈

        {

            BuildBullet(*tank);

            tank->CD=0;

        }

    }

    else

        tank->CD++;

    if(tank->CD >= 14)       //AI強化部分,在冷卻到達一定範圍即可使用

    {

        if(tank->y==38 )     //如果坦克在底部(這個最優先)

        {

            if(tank->x < 20) //在老家左邊

            {

                if(tank->direction==RIGHT)  //坦克方向朝左

                {

                    BuildBullet(*tank);     //發射子彈

                    tank->CD=0;

                }

            }

            else             //在老家右邊

                if(tank->direction==LEFT)   //坦克方向朝右

                {

                    BuildBullet(*tank);     //發射子彈

                    tank->CD=0;

                }

        }

        else if(tank->x==my_tank.x+1 || tank->x==my_tank.x || tank->x==my_tank.x-1)  //AI坦克在縱向上"炮口"對準我的坦克

        {

            if(tank->direction==DOWN && my_tank.y > tank->y || tank->direction==UP && my_tank.y < tank->y)

            {                               //若是AI朝下並且我的坦克在AI坦克下方(數值大的在下面)或者AI朝上我的坦克在AI上方

                int big=my_tank.y , smal=tank->y , i; 

                if(my_tank.y < tank->y)

                {

                    big=tank->y;

                    smal=my_tank.y;

                }

                for(i=smal+2;i<=big-2;i++)  //判斷AI炮口的直線上兩坦克間有無障礙

                    if(map[i][tank->x]!=0 || map[i][tank->x]!=5)      //若有障礙

                        break;

                if(i==big-1)                //若i走到big-1說明無障礙

                {

                    BuildBullet(*tank);     //則發射子彈

                    tank->CD=0;

                }

            }

        }

        else if(tank->y==my_tank.y+1 || tank->y==my_tank.y || tank->y==my_tank.y-1) //AI坦克在橫向上"炮口"對準我的坦克

        {

            if(tank->direction==RIGHT && my_tank.x > tank->x || tank->direction==LEFT && my_tank.x < tank->x)

            {                  //若是AI朝右並且我的坦克在AI坦克右方(數值大的在下面)或者AI朝左我的坦克在AI左方

                int big=my_tank.y , smal=tank->y , i;

                if(my_tank.x < tank->x)

                {

                    big=tank->x;

                    smal=my_tank.x;

                }

                for(i=smal+2;i<=big-2;i++)  //判斷AI炮口的直線上兩坦克間有無障礙

                    if(map[tank->y][i]!=0 || map[tank->y][i]!=5)      //若有障礙

                        break;

                if(i==big-1)   //若i走到big-1說明無障礙

                {

                    BuildBullet(*tank);     //則發射子彈

                    tank->CD=0;

                }

            }

        }

    }

}

 

 

 

void BuildBullet(Tank tank)  //子彈發射(建立),傳入結構體Tank,這裡包含改變了全域性變數結構體bullet

{                            //∵實現方式為順序迴圈建立子彈,每次呼叫改變的bullet陣列元素都不同

    switch(tank.direction)   //∴為了方便,不將bullet放入引數,bullet作為全域性變數使用

    {

        case UP    :

                bullet [bul_num].x = tank.x;

                bullet [bul_num].y = tank.y-2;

                bullet [bul_num].direction=1;

                break;

        case DOWN  :

                bullet [bul_num].x = tank.x;

                bullet [bul_num].y = tank.y+2;

                bullet [bul_num].direction=2;

                break;

        case LEFT  :

                bullet [bul_num].x = tank.x-2;

                bullet [bul_num].y = tank.y;

                bullet [bul_num].direction=3;

                break;

        case RIGHT :

                bullet [bul_num].x = tank.x+2;                                     

                bullet [bul_num].y = tank.y; 

                bullet [bul_num].direction=4;

                break; 

    }     

    bullet [bul_num].exist = 1;    //子彈被建立,此值為1則此子彈存在

    bullet [bul_num].initial = 1;  //子彈處於初建立狀態

    bullet [bul_num].my=tank.my;   //如果是我的坦克發射的子彈bullet.my=1,否則為0

    bul_num++;

    if(bul_num==BULLET_NUM)        //如果子彈編號增長到20號,那麼重頭開始編號

        bul_num=0;                 //考慮到地圖上不可能同時存在20顆子彈,所以陣列元素設定20個

}

 

 

void BulletFly(Bullet bullet[BULLET_NUM]) //子彈移動和打擊

{                                         //含有全域性變數Bullet的改變

    for(int i =0; i<BULLET_NUM;i++)

    {

        if(bullet [i].exist)              //如果子彈存在

        {   

            if(bullet [i].initial==0)     //如果子彈不是初建立的

            {                           

                if(map[bullet[i].y] [bullet[i].x]==0 || map[bullet[i].y] [bullet[i].x]==5)   //如果子彈座標當前位置無障礙

                    ClearBullet( bullet[i].x , bullet[i].y , BulletCheak(bullet[i].x , bullet[i].y ));     //抹除子彈圖形

                switch(bullet [i].direction)                                      //然後子彈座標變化(子彈變到下一個座標)

                {

                    case UP    :(bullet [i].y)--;break;

                    case DOWN  :(bullet [i].y)++;break;

                    case LEFT  :(bullet [i].x)--;break;

                    case RIGHT :(bullet [i].x)++;break;

                }

            }

            int collide = BulletCheak ( bullet [i].x , bullet [i].y );   //判斷子彈當前位置情況,判斷子彈是否碰撞,是否位於水面上。

            if( collide )                                                //如果檢測到當前子彈座標無障礙(無碰撞)(包括在地面上與在水面上)

                PrintBullet( bullet[i].x , bullet[i].y , collide);       //則列印子彈,若有碰撞則不列印

            else

                BulletHit( & bullet [i] );     //若有碰撞則執行子彈碰撞函式                  

            if(bullet [i].initial)             //若子彈初建立,則把初建立標記去除

                bullet [i].initial = 0;

            for(int j=0; j< BULLET_NUM ; j++)  //子彈間的碰撞判斷,若是我方子彈和敵方子彈碰撞則都刪除,若為兩敵方子彈則無視

                if(bullet [j].exist && j!=i && (bullet[i].my || bullet[j].my) && bullet[i].x==bullet[j].x && bullet[i].y==bullet[j].y)

                {                              //同樣的兩顆我方子彈不可能產生碰撞

                    bullet [j].exist=0;

                    bullet [i].exist=0;

                    ClearBullet( bullet[j].x , bullet[j].y , BulletCheak(bullet[j].x , bullet[j].y ));  //抹除j子彈圖形,子彈i圖形已被抹除

                    break;

                }

        }

    }

}

 

 

void BulletHit(Bullet* bullet)  //含有Tank全域性變數的修改,子彈間的碰撞不在本函式,子彈間碰撞已在BulletShoot中檢測並處理

{                               //∵每次打中的坦克都不一樣,不可能把所有坦克放在參數列中

    int x=bullet->x;            //∴這裡的Tank使用全域性變數

    int y=bullet->y;            //這裡傳入的值是子彈座標,這兩個值不需要改變

    int i;

    if(map[y][x]==1 || map[y][x]==2)  //子彈碰到磚塊

    {

        if(bullet->direction==UP || bullet->direction==DOWN)   //如果子彈是縱向的

            for(i = -1 ; i<=1 ; i++)

                if(map[y][x+i]==1 || map[y][x+i]==2)  //如果子彈打中磚塊兩旁為磚塊,則刪除磚,若不是(一旁為坦克或其他地形)則忽略

                {

                    map[y][x+i]=0;    //磚塊碎

                     GoToxy(2*x+2*i,y);

                    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED); //背景黑色

                     printf("  ");

                }

        if(bullet->direction==LEFT || bullet->direction==RIGHT)     //若子彈是橫向的  (與子彈縱向實現同理)

            for(i = -1 ; i<=1 ; i++)

                if(map[y+i][x]==1 || map[y+i][x]==2)

                {

                    map[y+i][x]=0;

                     GoToxy(2*x,y+i);

                    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED); //背景黑色

                     printf("  "); 

                }

        bullet->exist=0;           //這顆子彈已經不存在了

    }

    else if(map[y][x]==4 || map[y][x]==6 )  //子彈碰到邊框或者不可摧毀方塊

        bullet->exist=0;

    else if(bullet->my && map[y][x]>=100 && map[y][x]<104 )  //若我的子彈碰到了敵方坦克

    {

        int num = map[y][x]%100;   //map[y][x]%100 等同於 tank.num ,可通過map值讀取該坦克資訊

        if(AI_tank[num].model==3 && AI_tank[num].color==2)   //若為firm tank,且color==2。該坦克為綠色,表明沒有受到傷害

                AI_tank[num].color=3;                        //則變成黃色,color=3為黃色

        else if (AI_tank[num].model==3 && AI_tank[num].color==3)

                AI_tank[num].color=4;                        //4為紅色

        else                       //其他型別的坦克或者firm tank為紅色的情況

        {

            AI_tank[num].alive=0;

            ClearTank(AI_tank[num].x , AI_tank[num].y);      //清除該坦克

        }

        bullet->exist=0;

        score+=100;

        GoToxy(102,5);             //在副螢幕上列印出分數

        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);

        printf("%d ",score);

    }

    else if(map[y][x]==200 && bullet->my==0 )   //若敵方子彈擊中我的坦克

    {

        my_tank.alive=0;

        ClearTank(my_tank.x , my_tank.y);

        bullet->exist=0;

        my_tank.revive++;      //我的坦克復活次數+1(∵我的坦克復活次數與生命值有關∴放在這裡自減)

        score-=100;            //分數減少

        GoToxy(102,5);         //在副螢幕上列印出分數

        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);

        printf("%d   ",score);

        GoToxy(102,7);         //在副螢幕列印出我的剩餘生命值

        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);

        printf("%d   ", MAX_LIFE-my_tank.revive);

    }

//    else if(bullet->my==0 && map[y][x]>=100 && map[y][x]<104) //敵方子彈擊中敵方坦克,可以設定兩種子彈執行方式,這種暫時不用

//        bullet->exist=0;

    else if(map[y][x]==9)      //子彈碰到家(無論是誰的子彈)

    {

        bullet->exist=0;

        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_BLUE|FOREGROUND_RED|FOREGROUND_GREEN);

        GoToxy(38,37);     printf("      ");

        GoToxy(38,38);     printf("◢◣  ");

        GoToxy(38,39);     printf("███");

        GameOver(1);           //遊戲結束,傳入1代表老家被毀

    }

}

 

 

int BulletCheak (int x,int y)  //判斷子彈當前位置情況,判斷子彈是否碰撞,是否位於水面上。

{                              //有障礙返回0,無障礙且子彈在地面返回1,子彈在水面上返回2

    if(map[y][x]==0)

        return 1;

    else if(map[y][x]==5)

        return 2;

    else

        return 0;

}

 

 

void PrintBullet (int x,int y,int T)   //當前座標BulletCheak 的值做參量 T

{

    if(T==1)          //  T==1 表示子彈當前座標在陸地上

        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_INTENSITY);

    else if(T==2)     //  T==2 表示子彈當前座標在水面上

        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_INTENSITY|BACKGROUND_BLUE);

    GoToxy(2*x,y);

    printf("");

}

 

 

void ClearBullet(int x,int y,int T)   //當前座標BulletCheak 的值做參量 T

{

    GoToxy(2*x,y);

    if(T==2)        //  T==2 表示子彈當前座標在水面上

    {

        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|BACKGROUND_BLUE|FOREGROUND_BLUE|FOREGROUND_GREEN);

        printf("~");

    }

    else if(T==1)   //  T==1 表示子彈當前座標在陸地上

    {

        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_BLUE);

        printf("  ");

    }

}

 

 

//position為坦克生成位置,-1為左位置,0為中間,1為右,2為我的坦克位置

void BuildAITank(int* position, Tank* AI_tank)   //執行一次該函式只建立一個坦克

{                                         //rand函式公式:0<=rand()%(a+1)<=a  0+m<=rand()%(n-m+1)+m<=n  

                                          //rand函式實現1到n:1<=rand()%(n)+1<=n

       if(AIPositionCheak(*position))        //若此位置無障礙,可生成。position引數詳見AIPositionCheak函式定義

    {

        AI_tank->x= 20 + 18*(*position);  //20 + 18 * position 對應三個生成位置的x假座標

        AI_tank->y=2;

        if(AI_tank->revive==level_info[level-1].firm_tank_order)  //坦克出現(復活)次序==關卡資訊(level_info)中firm tank的出現次序

        {

            AI_tank->model = 3;           //3為firm tank的模型(外觀)

            AI_tank->color = 2;           //顏色引數2為綠色,具體詳見函式ColorChoose

        }

        else if(AI_tank->revive==level_info[level-1].fast_tank_order)  //同上if,這裡是fast_tank的

        {

            AI_tank->model = 2;

            AI_tank->color = rand()%6+1;  //若不是firm tank則隨機顏色,顏色引數為1~6,分別代表不同顏色,詳見函式ColorChoose

        }

        else      //普通坦克

        {

            AI_tank->model = 1;

               AI_tank->color = rand()%6+1;  //若不是firm tank則隨機顏色

        }

        AI_tank->alive = 1;       //坦克變為存在

        AI_tank->direction = 2 ;  //方向朝下

        AI_tank->revive++;        //復活次數+1

        PrintTank(*AI_tank);

        (*position)++; 

        remain_enemy--;

        GoToxy(102,9);            //在副螢幕上列印剩餘坦克數

        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);

        printf("%d ",remain_enemy);

        if(*position==2)          //position只能為0,1,-1,這裡position迴圈重置

            *position = -1;

             return ;                  //若生成了一輛坦克,則結束該函式

    }

}

 

 

int AIPositionCheak( int position )    //position為坦克生成位置2為我的坦克位置,其餘為AI位,-1為左位,0為中間位置,1為右位

{

    int    x,y;

    if(position==2)                    //2為我的坦克位置,現在暫時用不到

        x=15,y=38;

    else

        y=2 , x= 20 + 18 * position ;  //20 + 18 * position 對應三個生成位置的x假座標

    for(int i=0;i<3;i++)

        for(int j=0;j<3;j++)

            if( map[y+j-1][x+i-1]!=0)  //如果遍歷的九宮格里有障礙物

                return 0;              //則返回0,表示此生成位置有阻礙

    return 1;                          //否則生成1,表示此生成位置無阻礙

}

 

 

void MoveAITank(Tank* AI_tank) //AI專用函式,該函式主要為AI加強

{

       if(AI_tank->alive)         //如果坦克活著

    {

        if(AI_tank->stop!=0)   //坦克是否停止運動的判斷,若stop引數不為0

        {

            AI_tank->stop--;   //則此坦克本回合停止運動

            return;

        }

        if( !(rand()%23) )     //22分之1的概率執行方向重置

        {

            AI_tank->direction = rand()%4+1;

            if( rand()%3 )     //在方向重置後有2分之1的概率停止走動3步的時間

            {

                AI_tank->stop=2;

                return;

            }

        }

        ClearTank (AI_tank->x , AI_tank->y);

        if(TankCheak ( *AI_tank , AI_tank->direction))   //如果前方無障礙

            switch ( AI_tank->direction )

            {

                   case UP   : AI_tank->y--; break;  //上前進一格

                case DOWN : AI_tank->y++; break;  //下前進一格

                 case LEFT : AI_tank->x--; break;  //左前進一格

                case RIGHT: AI_tank->x++; break;  //右前進一格

            }

        else                     //前方有障礙

        {

            if(!(rand()%4))      //3分之1的概率亂轉

            {

                AI_tank->direction=rand()%4+1;

                AI_tank->stop=2; //亂轉之後停止走動3步的時間

                PrintTank(*AI_tank);

                return;          //∵continue會跳過下面的列印函式,∴這裡先列印

            }

            else                 //另外3分之2的機率選擇正確的方向

            {

                int j;

                for(j=1;j<=4;j++)

                    if(TankCheak ( *AI_tank , j ))  //迴圈判斷坦克四周有無障礙,此函式返值1為可通過

                        break;

                if(j==5)         //j==5說明此坦克四周都有障礙物,無法通行

                {

                    PrintTank(*AI_tank);

                    return;      //則跳過下面的while迴圈以防程式卡死

                }

                while(TankCheak ( *AI_tank , AI_tank->direction) == 0)  //如果前方仍有障礙

                    AI_tank->direction=(rand()%4+1);                    //則換個隨機方向檢測

            }

        }

        PrintTank(*AI_tank);     //列印AI坦克

    }

}

 

 

void BuildMyTank (Tank* my_tank) //建立我的坦克

{

    my_tank->x=15;

       my_tank->y=38;

       my_tank->stop=NULL;

       my_tank->direction=1;

    my_tank->model=0;

    my_tank->color=1;

    my_tank->alive=1;

    my_tank->my=1;

    my_tank->CD=7;

    PrintTank (*my_tank) ;   //列印我的坦克

}

 

 

void MoveMyTank(int turn )   //玩家專用函式,turn為keyboard函式裡因輸入不同方向鍵而傳入的不同的值

{

    ClearTank(my_tank.x , my_tank.y);        //map 陣列中“我的坦克”引數清除工作已在此函式中完成

    my_tank.direction=turn;                  //將鍵盤輸入的方向值傳入我的坦克方向值

    if(TankCheak ( my_tank , my_tank.direction ))  //若此時我的坦克當前方向上無障礙

        switch (turn)

        {

            case UP   : my_tank.y--; break;  //上前進一格

            case DOWN : my_tank.y++; break;  //下前進一格

            case LEFT : my_tank.x--; break;  //左前進一格

            case RIGHT: my_tank.x++; break;  //右前進一格

    }                                        //若坦克當前方向上有障礙則跳過座標變化直接列印該轉向的坦克

    PrintTank (my_tank);

}

 

 

bool TankCheak(Tank tank,int direction)  //檢測坦克前方障礙函式,參量為假座標。返值1為可通過,返值0為阻擋(人機共用)

{

    switch(direction)                    //direction變數   1上,2下,3左,4右

    {

        case UP:

            if (map[tank.y-2][tank.x]==0 && map[tank.y-2][tank.x-1]==0 && map[tank.y-2][tank.x+1]==0)

                return 1;

            else

                return 0;

        case DOWN:

            if (map[tank.y+2][tank.x]==0 && map[tank.y+2][tank.x-1]==0 && map[tank.y+2][tank.x+1]==0)

                return 1;

            else

                return 0;

        case LEFT:

            if (map[tank.y][tank.x-2]==0 && map[tank.y-1][tank.x-2]==0 && map[tank.y+1][tank.x-2]==0)

                return 1;

            else

                return 0;

        case RIGHT:

            if (map[tank.y][tank.x+2]==0 && map[tank.y-1][tank.x+2]==0 && map[tank.y+1][tank.x+2]==0)

                return 1;

            else

                return 0;

        default:

            printf("錯誤!!");

            Sleep(5000);

            return 0;

    }

}

 

 

void ClearTank(int x,int y)   //清除坦克函式(人機共用)

{

    for(int i=0;i<3;i++)

        for(int j=0;j<3;j++)

        {                     //將坦克佔用的地圖上的九格去掉

             map[y+j-1][x+i-1]=0;

            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN);

            GoToxy(2*x+2*j-2,y+i-1);

            printf("  ");

        }

}

 

 

void PrintTank(Tank tank)     //列印坦克(人機共用) 由於讀取的Tank引數較多,故就不將引數一一傳入了

{                             // tank.color引數對應不同的顏色,範圍 1 ~ 6

    ColorChoose(tank.color);  //顏色選擇函式   定義一個陣列裡裝著字元指標(既裝字串)的陣列指標(指向一維陣列首地址的指標)

    char *(*tankF)[4] = tank_figure[tank.model];  //將二維陣列首址賦初值給陣列指標 model==0為我的坦克,4為電腦1坦克,8為電腦2,類推

    for(int i = 0; i < 3; i++)   

    {

        GoToxy((tank.x-1)*2 , tank.y-1+i);        //在坦克中心座標的左邊,上中下三行列印

        printf("%s", tankF[i][tank.direction-1]); //列印的是地址,地址既字串

         for(int j=0;j<3;j++)

            if(tank.my)       //若為我的坦克

                map[tank.y+j-1][tank.x+i-1]=200;  //在map上把"坦克"九格填滿代表敵我坦克的引數。敵方此值為100~103,我方為200

            else

                map[tank.y+j-1][tank.x+i-1]=100+tank.num;  //這樣可以通過map值讀取坦克編號,讀取操作在BulletHit 函式

    }

}

 

 

void HideCursor()  //隱藏游標

{                  //CONSOLE_CURSOR_INFO結構體包含控制檯游標的資訊,DWORD dwSize游標百分比厚度(1~100)和BOOL bVisible游標是否可見

    CONSOLE_CURSOR_INFO cursor_info={1,0};

    SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info); //SetConsoleCursorInfo用來設定指定的控制檯游標的大小和可見性。

}

 

 

void GoToxy(int x,int y)  //游標移動函式,X表示橫座標,Y表示縱座標。

{

    COORD  coord;         //使用標頭檔案自帶的座標結構

    coord.X=x;            //這裡將int型別值傳給short,不過程式中涉及的座標值均不會超過short範圍

    coord.Y=y;

    HANDLE a=GetStdHandle(STD_OUTPUT_HANDLE);  //獲得標準輸出控制程式碼

    SetConsoleCursorPosition(a,coord);         //以標準輸出的控制程式碼為引數設定控制檯游標座標

}

 

 

void ColorChoose(int color)   //顏色選擇函式

{

    switch(color)

    {

           case 1:               //天藍色(我的坦克顏色)

            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);

            break;

        case 2:               //綠色

            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);    

            break;

        case 3:               //黃色

            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);

            break;

        case 4:               //紅色

            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);

            break;

        case 5:               //紫色

            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);

            break;

        case 6:               //白色

            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_GREEN);

            break;

        case 7:               //深藍色(∵顏色深難與黑色背景辨識度不高 ∴坦克顏色不選用此顏色),只用在字型顏色閃爍中

            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);

            break;

    }

}

 

 

void Stop()    //暫停

{

    int color=1,timing=0;

    while(1)

    {

        if(timing++%30==0)

        {

            ColorChoose(color);   //顏色選擇

            GoToxy(100,13);       //副螢幕列印

            printf("遊戲暫停");

            GoToxy(88,17);

            printf("按Enter鍵回到遊戲");

            GoToxy(88,18);

            printf("或按 Esc鍵退出遊戲");

            if(++color==8)

                color=1;

        }

        if (GetAsyncKeyState( 0xD )& 0x8000)      //Enter鍵

        {

            GoToxy(100,13);       //副螢幕列印

            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);

            printf("正在進行");   //覆蓋掉原來的提示

            GoToxy(88,17);

            printf("                     ");

            GoToxy(88,18);

            printf("                     ");

            break;

        }

        else if(GetAsyncKeyState( 0x1B )& 0x8000) //Esc鍵退出    

            exit(0);

        Sleep(20);

    }

}

 

 

void ClearMainScreen()  //主螢幕清屏函式,因使用system("cls");再列印框架有一定機率造成框架上移一行的錯誤,所以單獨編寫清屏函式

{

    for(int i=1;i<40;i++)

    {

        GoToxy(2,i);

        printf("                                                                              ");

    }

}

 

 

void Frame ()     //列印遊戲主體框架

{                 //SetConsoleTextAttribute為設定文字顏色和文字背景顏色函式

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_INTENSITY);

    printf("  ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁  ");

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_BLUE); 

    printf("  ▂▂▂▂▂▂▂▂▂▂▂▂▂ 
");

    for(int i=0;i<14;i++)

    {

        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_INTENSITY);

        printf("▕                                                                              ▏");

        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_BLUE); 

        printf(" |                          |
");

    }

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_INTENSITY);

    printf("▕                                                                              ▏");

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_BLUE); 

    printf(" |═════════════|
");

    for(int i=0;i<24;i++)

    {

        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_INTENSITY);

        printf("▕                                                                              ▏");

        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_BLUE); 

        printf(" |                          |
");

    }

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_INTENSITY);

    printf("  ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔  ");

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY| FOREGROUND_BLUE); 

    printf(" ﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊
");

    SideScreen ();  //列印副螢幕

}

 

 

void PrintMap()     // 列印地圖(地圖既地圖障礙物)

{

    for(int j=0;j<41;j++)

        for(int i=0;i<41;i++)

            if(map[i][j]==6)

            {

                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN

                    |FOREGROUND_RED|FOREGROUND_BLUE|BACKGROUND_GREEN|BACKGROUND_RED|BACKGROUND_BLUE);

                GoToxy(2*j,i);

                printf("■");

            }

            else if(map[i][j]==2)

            {

                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED|BACKGROUND_GREEN|BACKGROUND_RED);

                GoToxy(2*j,i);

                printf("▓");

            }

            else if(map[i][j]==1)

            {

                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|BACKGROUND_GREEN|BACKGROUND_RED);

                GoToxy(2*j,i);

                printf("▓");

            }

            else if(map[i][j]==5)

            {                      

                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|BACKGROUND_BLUE|FOREGROUND_BLUE|FOREGROUND_GREEN);

                GoToxy(2*j,i);

                printf("~");

            }

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_BLUE|FOREGROUND_RED|FOREGROUND_GREEN);

    GoToxy(38,37);     printf("◣◢");

    GoToxy(38,38);     printf("███");    //∵無論地圖怎麼變,家所在位置不變,且家的字元多種,不方便用上述方式列印

    GoToxy(38,39);     printf("◢█◣");    //∴直接列印(且家的map值與符號無關)

}

 

 

void GetMap()      //地圖存放函式

{                   //map裡的值: 個位數的值為地圖方塊部分,百位數的值為坦克

    int i ,j;      //map裡的值: 0為可通過陸地,1為紅磚,2待定,5為水,100為敵方坦克,200為我的坦克,

    int Map[8][41][41]=

    {

        {

            {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, 

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,4}, 

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,4}, 

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,4}, 

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,4}, 

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,6,6,6,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,6,6,6,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,6,6,6,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,4}, 

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}, 

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,1,1,1,4},

            {4,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,1,1,1,4}, 

            {4,6,6,6,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,6,6,6,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,4}, 

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4}

        },

        {

            {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6,6,6,6,6,2,2,2,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6,6,6,6,6,2,2,2,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6,6,6,6,6,2,2,2,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,0,0,0,0,0,0,6,6,6,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,0,0,0,0,0,0,6,6,6,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,0,0,0,0,0,0,6,6,6,0,0,0,4},

            {4,1,1,1,2,2,2,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,6,6,6,0,0,0,4},

            {4,1,1,1,2,2,2,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,6,6,6,0,0,0,4},

            {4,1,1,1,2,2,2,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,6,6,6,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,1,1,1,0,0,0,2,2,2,1,1,1,6,6,6,6,6,6,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,1,1,1,0,0,0,2,2,2,1,1,1,6,6,6,6,6,6,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,1,1,1,0,0,0,2,2,2,1,1,1,6,6,6,6,6,6,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,0,0,0,2,2,2,6,6,6,1,1,1,2,2,2,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,0,0,0,2,2,2,6,6,6,1,1,1,2,2,2,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,0,0,0,2,2,2,6,6,6,1,1,1,2,2,2,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,0,0,0,1,1,1,6,6,6,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,0,0,0,1,1,1,6,6,6,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,0,0,0,1,1,1,6,6,6,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,1,1,1,6,6,6,1,1,1,0,0,0,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,1,1,1,6,6,6,1,1,1,0,0,0,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,1,1,1,6,6,6,1,1,1,0,0,0,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,0,0,0,2,2,2,1,1,1,6,6,6,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,0,0,0,2,2,2,1,1,1,6,6,6,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,0,0,0,2,2,2,1,1,1,6,6,6,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,6,6,6,6,6,6,6,6,6,2,2,2,0,0,0,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,4},

            {4,6,6,6,6,6,6,6,6,6,2,2,2,0,0,0,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,4},

            {4,6,6,6,6,6,6,6,6,6,2,2,2,0,0,0,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,4},

            {4,6,6,6,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,6,6,6,6,6,6,0,0,0,0,0,0,4},

            {4,6,6,6,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,6,6,6,6,6,6,0,0,0,0,0,0,4},

            {4,6,6,6,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,6,6,6,6,6,6,0,0,0,0,0,0,4},

            {4,6,6,6,0,0,0,0,0,0,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,1,1,1,1,1,1,0,0,0,4},

            {4,6,6,6,0,0,0,0,0,0,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,1,1,1,1,1,1,0,0,0,4},

            {4,6,6,6,0,0,0,0,0,0,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,1,1,1,1,1,1,0,0,0,4},

            {4,2,2,2,6,6,6,6,6,6,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,6,6,6,6,6,6,4},

            {4,2,2,2,6,6,6,6,6,6,6,6,6,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,6,6,6,6,6,6,4},

            {4,2,2,2,6,6,6,6,6,6,6,6,6,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,6,6,6,6,6,6,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6,6,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6,6,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6,6,4},

            {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4}

        },

        {

            {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4},

            {4,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,1,1,1,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,1,1,1,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,1,1,1,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,6,6,6,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,6,6,6,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,6,6,6,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,6,6,6,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,1,1,1,6,6,6,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,1,1,1,6,6,6,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,4},

            {4,6,6,6,0,0,0,1,1,1,5,5,5,0,0,0,6,6,6,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,5,5,5,0,0,0,6,6,6,0,0,0,1,1,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,5,5,5,0,0,0,6,6,6,0,0,0,1,1,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,5,5,5,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,5,5,5,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,5,5,5,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,1,1,1,0,0,0,1,1,1,5,5,5,5,5,5,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,1,1,1,4},

            {4,1,1,1,0,0,0,1,1,1,5,5,5,5,5,5,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,1,1,1,4},

            {4,1,1,1,0,0,0,1,1,1,5,5,5,5,5,5,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,1,1,1,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,6,6,6,6,6,6,4},

            {4,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,4},

            {4,1,1,1,1,1,1,0,1,1,1,1,1,0,0,0,6,6,6,0,0,0,1,1,1,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,4},

            {4,1,1,1,1,1,1,0,1,1,1,1,1,0,0,0,6,6,6,0,0,0,1,1,1,0,0,0,5,5,5,0,0,0,1,1,1,1,1,1,4},

            {4,1,1,1,1,1,1,0,1,1,1,1,1,0,0,0,6,6,6,0,0,0,1,1,1,0,0,0,5,5,5,0,0,0,1,1,1,0,0,0,4},

            {4,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,5,5,5,0,0,0,1,1,1,0,0,0,4},

            {4,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,1,1,1,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,6,6,6,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,4},    

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,4},

            {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4}

        },

        {

            {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,6,6,6,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,4},

            {4,6,6,6,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,1,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,1,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,4},

            {4,5,5,5,0,0,0,0,1,1,1,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,4},

            {4,5,5,5,0,0,0,0,1,1,1,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,4},

            {4,5,5,5,0,0,0,0,1,1,1,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,5,5,5,4},

            {4,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,5,5,5,4},

            {4,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,5,5,5,4},

            {4,0,0,0,0,0,0,1,1,1,1,1,0,0,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,4},

            {4,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,4},

            {4,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,4},

            {4,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,4},

            {4,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,4},

            {4,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,4},

            {4,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,4},

            {4,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,4},

            {4,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,4},

            {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4}

        },

        {

            {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4},

            {4,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,5,5,5,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,5,5,5,5,5,5,5,5,5,4},

            {4,5,5,5,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,5,5,5,5,5,5,5,5,5,4},

            {4,5,5,5,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,5,5,5,5,5,5,5,5,5,4},

            {4,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5,4},

            {4,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5,4},

            {4,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5,4},

            {4,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,6,6,6,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,6,6,6,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,6,6,6,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,5,5,5,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,5,5,5,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,5,5,5,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,4},

            {4,5,5,5,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5,5,5,5,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,4},

            {4,5,5,5,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5,5,5,5,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,4},

            {4,5,5,5,5,5,5,0,0,0,5,5,5,0,0,0,5,5,5,5,5,5,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,5,5,5,4},

            {4,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,5,5,5,4},

            {4,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,5,5,5,4},

            {4,0,0,0,5,5,5,5,5,5,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,1,1,1,0,0,0,5,5,5,4},

            {4,0,0,0,5,5,5,5,5,5,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,1,1,1,0,0,0,5,5,5,4},

            {4,0,0,0,5,5,5,5,5,5,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,1,1,1,0,0,0,5,5,5,4},

            {4,1,1,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,5,5,5,4},

            {4,1,1,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,5,5,5,4},

            {4,1,1,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,5,5,5,4},

            {4,5,5,5,5,5,5,0,0,0,5,5,5,5,5,5,0,0,0,5,5,5,1,1,1,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,4},

            {4,5,5,5,5,5,5,0,0,0,5,5,5,5,5,5,0,0,0,5,5,5,1,1,1,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,4},

            {4,5,5,5,5,5,5,0,0,0,5,5,5,5,5,5,0,0,0,5,5,5,1,1,1,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,5,5,5,4},

            {4,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,5,5,5,4},

            {4,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,0,0,0,5,5,5,4},

            {4,0,0,0,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,5,5,5,5,5,5,4},

            {4,0,0,0,5,5,5,5,5,5,5,5,5,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,5,5,5,0,0,0,5,5,5,5,5,5,4},

            {4,0,0,0,5,5,5,5,5,5,5,5,5,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,5,5,5,0,0,0,5,5,5,5,5,5,4},

            {4,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,5,5,5,0,0,0,0,0,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4}

        },

        {

            {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,4},

            {4,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,1,0,0,0,0,0,0,2,2,2,2,0,0,0,0,0,0,1,1,1,1,0,0,0,1,1,0,4},

            {4,0,0,1,1,1,0,0,0,0,0,0,1,1,1,0,0,0,0,2,2,2,2,2,2,0,0,0,0,1,1,1,0,0,0,0,0,0,1,1,4},

            {4,0,1,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,2,2,2,2,2,2,2,2,0,0,0,1,1,0,0,0,0,0,0,0,1,1,4},

            {4,0,1,1,0,0,0,0,0,0,0,0,0,1,1,1,0,0,2,2,2,2,2,2,2,2,0,0,1,1,1,0,0,0,0,0,0,0,1,1,4},

            {4,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,1,1,4},

            {4,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,1,1,4},

            {4,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,1,1,4},

            {4,1,1,0,0,0,0,0,0,0,0,0,1,1,1,2,2,2,2,6,6,6,6,6,6,2,2,2,2,1,1,1,0,0,0,0,0,1,1,1,4},

            {4,1,1,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,6,6,6,6,6,6,2,2,2,2,1,1,1,1,0,0,0,0,1,1,1,4},

            {4,1,1,0,0,0,0,0,0,0,1,1,1,1,1,2,2,2,2,6,6,6,6,6,6,2,2,2,2,1,1,1,1,0,0,0,1,1,1,1,4},

            {4,0,1,1,0,0,0,0,0,0,1,1,1,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,1,1,1,0,0,1,1,1,1,4},

            {4,0,1,1,1,0,0,0,0,1,1,1,1,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,1,1,1,1,1,1,1,1,1,4},

            {4,0,0,1,1,1,1,1,1,1,1,1,1,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,1,1,1,1,1,1,1,1,1,4},

            {4,0,0,0,1,1,1,1,1,1,1,1,1,6,6,6,6,6,6,1,1,1,6,6,6,6,6,6,1,1,1,1,1,1,1,1,1,1,1,0,4},

            {4,0,0,0,1,1,1,1,1,1,1,1,1,6,6,6,6,6,6,1,1,1,6,6,6,6,6,6,1,1,1,1,1,1,1,1,1,1,1,0,4},

            {4,0,0,0,0,1,1,1,1,1,1,1,1,6,6,6,6,6,6,1,1,1,6,6,6,6,6,6,1,1,1,1,1,1,1,1,1,1,0,0,4},

            {4,0,0,0,0,0,1,1,1,1,1,1,1,6,6,6,0,0,0,1,1,1,0,0,0,6,6,6,1,1,1,1,1,1,1,1,1,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,1,1,1,6,6,6,0,0,0,1,1,1,0,0,0,6,6,6,1,1,1,1,1,1,1,1,1,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,1,1,1,6,6,6,0,0,0,1,1,1,0,0,0,6,6,6,1,1,1,1,1,1,1,1,1,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,4},

            {4,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,6,6,6,6,6,6,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,4},

            {4,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,6,6,6,6,6,6,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,4},

            {4,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,4},

            {4,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,4},

            {4,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,4},

            {4,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,4},

            {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4}

        },

        {

            {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4},

            {4,0,0,0,0,0,0,0,0,0,6,6,6,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,6,6,6,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,6,6,6,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,6,6,6,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,6,6,6,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,6,6,6,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,6,6,6,0,0,0,0,0,0,6,6,6,0,0,0,6,6,6,6,6,6,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,6,6,6,0,0,0,0,0,0,6,6,6,0,0,0,6,6,6,6,6,6,4},

            {4,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,6,6,6,0,0,0,0,0,0,6,6,6,0,0,0,6,6,6,6,6,6,4},

            {4,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,6,6,6,1,1,1,0,0,0,0,0,0,0,0,0,6,6,6,4},

            {4,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,6,6,6,1,1,1,0,0,0,0,0,0,0,0,0,6,6,6,4},

            {4,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,6,6,6,1,1,1,0,0,0,0,0,0,0,0,0,6,6,6,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,6,6,6,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,6,6,6,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,6,6,6,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,6,6,6,0,0,0,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,4},

            {4,0,0,0,0,0,0,6,6,6,0,0,0,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,4},

            {4,0,0,0,0,0,0,6,6,6,0,0,0,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,4},

            {4,6,6,6,0,0,0,6,6,6,0,0,0,0,0,0,1,1,1,0,0,0,6,6,6,0,0,0,0,0,0,6,6,6,1,1,1,0,0,0,4},

            {4,6,6,6,0,0,0,6,6,6,0,0,0,0,0,0,1,1,1,0,0,0,6,6,6,0,0,0,0,0,0,6,6,6,1,1,1,0,0,0,4},

            {4,6,6,6,0,0,0,6,6,6,0,0,0,0,0,0,1,1,1,0,0,0,6,6,6,0,0,0,0,0,0,6,6,6,1,1,1,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,6,6,6,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,6,6,6,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,6,6,6,0,0,0,0,0,0,4},

            {4,0,0,0,6,6,6,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,4},

            {4,0,0,0,6,6,6,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,4},

            {4,0,0,0,6,6,6,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,4},

            {4,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,4},

            {4,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,4},

            {4,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,4},

            {4,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,1,1,1,6,6,6,0,0,0,6,6,6,0,0,0,0,0,0,1,1,1,4},

            {4,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,1,1,1,6,6,6,0,0,0,6,6,6,0,0,0,0,0,0,1,1,1,4},

            {4,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,1,1,1,6,6,6,0,0,0,6,6,6,0,0,0,0,0,0,1,1,1,4},

            {4,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,6,6,6,0,0,0,0,0,0,4},

            {4,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,1,1,1,6,6,6,0,0,0,0,0,0,4},

            {4,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,1,1,1,6,6,6,0,0,0,0,0,0,4},

            {4,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,4},

            {4,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,4},

            {4,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,4},

            {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4}

        },

        {

            {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,4},

            {4,0,0,0,1,1,1,5,5,5,5,5,5,0,0,0,6,6,6,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,1,1,1,5,5,5,5,5,5,0,0,0,6,6,6,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,1,1,1,5,5,5,5,5,5,0,0,0,6,6,6,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,5,5,5,5,5,5,1,1,1,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,0,0,0,6,6,6,0,0,0,4},

            {4,0,0,0,0,0,0,5,5,5,5,5,5,1,1,1,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,0,0,0,6,6,6,0,0,0,4},

            {4,0,0,0,0,0,0,5,5,5,5,5,5,1,1,1,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,0,0,0,6,6,6,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,1,1,1,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,1,1,1,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,1,1,1,0,0,0,0,0,0,4},

            {4,0,0,0,6,6,6,0,0,0,0,0,0,5,5,5,5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,6,6,6,0,0,0,0,0,0,5,5,5,5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,6,6,6,0,0,0,0,0,0,5,5,5,5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,0,0,0,5,5,5,5,5,5,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,0,0,0,5,5,5,5,5,5,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,0,0,0,5,5,5,5,5,5,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,0,0,0,0,0,0,6,6,6,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,0,0,0,0,0,0,6,6,6,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,0,0,0,0,0,0,6,6,6,4},

            {4,0,0,0,1,1,1,5,5,5,5,5,5,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,1,1,1,5,5,5,5,5,5,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,1,1,1,5,5,5,5,5,5,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,6,6,6,0,0,0,5,5,5,5,5,5,0,0,0,0,0,0,5,5,5,5,5,5,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,4},

            {4,6,6,6,0,0,0,5,5,5,5,5,5,0,0,0,0,0,0,5,5,5,5,5,5,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,4},

            {4,6,6,6,0,0,0,5,5,5,5,5,5,0,0,0,0,0,0,5,5,5,5,5,5,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,0,0,0,0,0,0,5,5,5,5,5,5,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,0,0,0,0,0,0,5,5,5,5,5,5,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,0,0,0,0,0,0,5,5,5,5,5,5,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,0,0,0,4},

            {4,0,0,0,0,0,0,0,0,0,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},

            {4,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,0,0,0,1,1,1,6,6,6,0,0,0,4},

            {4,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,0,0,0,1,1,1,6,6,6,0,0,0,4},

            {4,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,0,0,0,1,1,1,6,6,6,0,0,0,4},

            {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4}

        },

    };

        for(i=0;i<41;i++)

            for(j=0;j<41;j++)

                    map[i][j]=Map[level-1][i][j];

    PrintMap();         //列印地圖

}

 

 

void GameOver(bool home)

{

    int timing=0,color=1;

    while(1)

    {

        if(timing++%30==0)         //遊戲結束原因為生命值為0

        {

            ColorChoose(color);    //顏色選擇

            if(home)               //遊戲結束原因為老家被毀,則多列印一行字以提示玩家

            {

                GoToxy(37,19);     //主螢幕中心列印

                printf("老家被毀!");

            }

            GoToxy(37,20);         //主螢幕中心列印

            printf("遊戲結束!");

            GoToxy(100,13);        //副螢幕列印

            printf("遊戲結束");

            GoToxy(88,17);

            printf("請按Enter鍵重新開始!");

            GoToxy(88,18);

            printf("或按 Esc鍵退出遊戲!");

            if(++color==8)

                color=1;

        }

        if (GetAsyncKeyState( 0xD )& 0x8000)  //Enter鍵

        {

//            system("cls");       //清屏,這裡清屏後再次列印框架有一定機率造成框架上移一行的bug,因此選用自建清屏函式

//            Frame ();            //重新列印遊戲框架

            score-=500;          //分數-500

            ClearMainScreen();   //主屏清屏函式,無需再次列印框架

            Initialize();        //從本關重新開始

            break;

        }

        else if(GetAsyncKeyState( 0x1B )& 0x8000)  //Esc鍵退出    

            exit(0);

        Sleep(20);

    }

}

 

 

void NextLevel()

{

    int timing=0,color=1;

    level++;

    if(level<=MAX_LEVEL)

        while(1)

        {

            if(timing++%10==0)

            {

                ColorChoose(color);   //顏色選擇   

                GoToxy(37,20);        //主螢幕中心列印

                printf("恭喜過關!");

                GoToxy(100,13);       //副螢幕列印

                printf("等待下關");

                GoToxy(87,17);

                printf("請按Enter鍵進入下一關!");

                GoToxy(88,18);

                printf("或按 Esc鍵退出遊戲!");

                if(++color==8)    

                    color=1;

            }

            if (GetAsyncKeyState( 0xD )& 0x8000)  //Enter鍵

            {

                GoToxy(88,17);        //抹除副螢幕中的提示

                printf("                     ");

                GoToxy(88,18);

                printf("                     ");

                ClearMainScreen();   //主屏清屏函式,無需再次列印框架

                Initialize();        //初始化從下一關開始,level已++

                break;

            }

            else if(GetAsyncKeyState( 0x1B )& 0x8000)  //Esc鍵退出    

                exit(0);

            Sleep(20);

        }

    else   //level>8 通關

        while(1)

        {

            if(timing++%5==0)

            {

                ColorChoose(color);

                GoToxy(33,20);        //主螢幕中心列印

                printf("恭喜通過全部關卡!");

                GoToxy(100,13);       //副螢幕列印

                printf("已通全關");

                GoToxy(88,17);

                printf("恭喜通過全部關卡!");

                GoToxy(88,19);

                printf("按 Esc鍵退出遊戲!");

                if(++color==8)    

                    color=1;

            }

            if(GetAsyncKeyState( 0x1B )& 0x8000)  //Esc鍵退出    

                exit(0);

            Sleep(10);

        }

}

 

 

void GameCheak()

{                           //剩餘敵人為0且四坦克全部不存活

    if(remain_enemy<=0 && !AI_tank[0].alive && !AI_tank[1].alive && !AI_tank[2].alive && !AI_tank[3].alive )

        NextLevel();        //進入下一關

    if(my_tank.revive>=MAX_LIFE)   //我的生命值(復活次數)全部用完 MAX_LIFE

        GameOver(0);        //遊戲結束,傳入0代表我的復活次數用光(生命值為0)。遊戲結束有兩種判斷,另一種是老家被毀

}

 

 

void SideScreen ()  //副螢幕 行(84起,110末,若雙字元寬則在108列印最後一個字)列(11上屏末,13下屏初,39下屏末。為美觀最好打在38)

{                   // |         第  d  關         |   " |                          |
"

    GoToxy(93,2);

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED);

    printf("第     關");

    GoToxy(92,5);

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);

    printf("分  數:");

    GoToxy(92,7);

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);

    printf("生  命:");

    GoToxy(86,9);

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);

    printf("剩餘敵方坦克:");

    GoToxy(86,11);

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);

    printf("當前遊戲速度:  %d",21-speed);

    GoToxy(86,13);

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);

    printf("當前遊戲狀態:");

    GoToxy(94,19);

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED);

    GoToxy(94,24);

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED);

    printf("幫  助");

    GoToxy(86,27);

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);

    printf("方向鍵  ←↑→↓  移動");

    GoToxy(93,29);

    printf("x 鍵 射擊");

    GoToxy(89,31);

    printf("+ - 調整遊戲速度");

    GoToxy(90,33);

    printf("遊戲速度範圍1~20");

    GoToxy(90,35);

    printf("Enter鍵 暫停遊戲");

    GoToxy(90,37);

    printf("Esc鍵  退出遊戲");

/*    printf("幫  助");     //這是第二種詳細說明的樣式

    GoToxy(86,21);

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);

    printf("方向鍵  ←↑→↓  移動");

    GoToxy(93,23);

    printf("x 鍵 射擊");

    GoToxy(89,25);

    printf("+ - 調整遊戲速度");

    GoToxy(90,27);

    printf("遊戲速度範圍1~20");

    GoToxy(90,29);

    printf("Enter鍵 暫停遊戲");

    GoToxy(90,31);

    printf("Esc鍵  退出遊戲");

    GoToxy(86,33);

    printf("敵方坦克全部消滅則過關");

    GoToxy(87,34);

    printf("己方坦克生命值為0 或");

    GoToxy(86,35);

    printf("正下方的老家被毀則失敗");

    GoToxy(86,36);

    printf("己坦克與敵坦克子彈碰撞");

    GoToxy(87,37);

    printf("則抵消,敵坦克間子彈碰");

    GoToxy(86,38);

    printf("撞不抵消且可穿過敵坦克");*/

}

 

 

void Initialize()      //初始化

{

    remain_enemy=16;

    my_tank.revive=0;  //我的坦克復活次數為0

    position=0;

    bul_num=0;

    GetMap();

    BuildMyTank( &my_tank );

    for(int i=0;i<12;i++)     //子彈初始化

    {

        bullet [i].exist=0;

        bullet [i].initial=0;

    }

    for(int i=0;i<=3;i++)         //AI坦克初始化

    {

        AI_tank [i].revive=0;

        AI_tank [i].alive=0;  //初始化坦克全是不存活的,BuildAITank()會建立重新建立不存活的坦克

        AI_tank [i].stop=0;

        AI_tank [i].num=i;

        AI_tank [i].my=0;

        AI_tank [i].CD=0;

    }

    GoToxy(97,2);                        //在副螢幕上關卡數

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);

    printf("%d",level);

    GoToxy(102,5);                       //在副螢幕上列印分數

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);

    printf("%d   ",score);

    GoToxy(102,7);                       //在副螢幕列印我的剩餘生命值

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);

    printf("%d", MAX_LIFE-my_tank.revive);

    GoToxy(102,9);                       //在副螢幕上列印剩餘坦克數

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);

    printf("%d ",remain_enemy);

    GoToxy(100,13);                      //在副螢幕上列印狀態

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE|FOREGROUND_GREEN);

    printf("正在遊戲");

}

很長,但是遊戲效果很好。在遊玩之餘,多看看程式碼,不難學到許多windows.h的用途以及多函式程式設計,今天的分享也就到這裡了,我們下次見!


相關文章