document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. /*Date:06hb.10.2010
  2. **Time:3.04pm
  3. **GAME TITLE: Space Adventure
  4. **A Game For Windows [by using Dev C++]
  5. **Copyright 2010 [@zrI & ZomBiedy]
  6. */
  7. #include <iostream>
  8. #include <conio.h>
  9. #include <iomanip>
  10. #include <time.h>
  11. #include <stdlib.h>
  12.  
  13. using namespace std;
  14.  
  15. struct GAME
  16. {                            //struct definition
  17.  char menu[15];
  18. };
  19.  
  20. struct P_DATA
  21. {
  22.        string P1name;
  23.        string P2name;      
  24. };
  25.  
  26. //global variables
  27. const int row=9,col=8;
  28. int i,j,current_i,current_j,step;
  29. GAME advGame[4];
  30. P_DATA user[1];
  31. int no_menu;
  32. int hp=20, mp=20, ehp=30, move, emove;
  33. const int size_question=70;//to make it really random, try to get around 70 questions
  34. int LimitBattle=35; //limiting battle to only 35
  35. int LimitRest = 20; //limiting resting to only 20
  36.  
  37. struct WORLD                                       //world of the game
  38. {
  39.     char* board[row][col];                         //the board, or the playing field
  40.     int game_element[row][col];                    //1 resting,2 question,3 portal/jump,4 battle
  41. }world;                                            //note: make game_element at [0][0],[row-1][col-1] = 0
  42.  
  43. struct QUESTIONS
  44. {
  45.  string q;
  46.  char ans;
  47.  int status; //keep status of being answer or not. if already use, value 1
  48. }questions[size_question];
  49.  
  50. //function prototypes
  51. int dice(void);
  52. void intBoard(void);
  53. void intgame_element(void);
  54. void displayBoard(void);
  55. void initialMenu(GAME advGame[4]);
  56. void GameStart(int player);
  57. void S_player(void);
  58. void M_player(void);                            
  59. void newGame(void);
  60. void guideline(void);
  61. void credit(void);
  62. void selectMenu(int no_menu);
  63. void displayMenu(GAME advGame[]);
  64. void wait(float seconds);
  65. void win(int turn);
  66. int question(void);
  67. void picture(void);
  68. void initializeQuestion (void);
  69. void initializeStatus (void);
  70. void slowstepsBoard2(int step);
  71. int hp2=20, mp2=20;
  72. void rest(int turn);
  73. void portal(int turn);
  74. int battle (int turn);
  75. int player;
  76. void lose(int turn);
  77. void slowstepsBoard(int step);
  78. int current_i2,current_j2;
  79.  
  80. //======================================================================================================
  81. //PRIMARY MAIN FUNCTION
  82. int main(void)
  83. {
  84.    srand(time(NULL)) ;             //set rand to use time as seed
  85.    
  86.    initialMenu(advGame);
  87.    displayMenu(advGame);    //display game menu
  88.    cout<<" Enter Number: ";             //choose menu
  89.    cin>>no_menu;
  90.    system("cls");
  91.    selectMenu(no_menu);
  92.    getch();
  93. }
  94. //======================================================================================================
  95. //create game menu function (initialize)
  96. void initialMenu(GAME advGame[4])
  97. {
  98.    strcpy(advGame[0].menu,". NEW GAME");
  99.    strcpy(advGame[1].menu,". GUIDELINE");
  100.    strcpy(advGame[2].menu,". ABOUT");
  101.    strcpy(advGame[3].menu,". EXIT");
  102. }
  103. //======================================================================================================
  104. //display game menu
  105. void displayMenu(GAME advGame[4])
  106. {    
  107.      cout<<endl<<"================================================================================"<<endl<<" PROGRAM\\t: DIPLOMA IN COMPUTER SCIENCE(CS110)"<<endl;
  108.      cout<<" GROUP\\t\\t: CSD2K"<<endl<<" SESSIONS\\t: JULY-NOVEMBER 2010"<<endl<<endl<<endl<<"================================================================================"<<endl;
  109.      cout<<" GAME TITLE\\t: SPACE ADVENTURE"<<endl<<" TEAM NAME\\t: Mytho (Legend) "    <<endl<<" DESIGNER\\t: @zrI & ZomBiedy "<<endl;
  110.      cout<<endl<<endl<<endl<<" GAME MENU:"<<endl;
  111.      for(int i=0;i<4;i++)
  112.             cout<<endl<<"\\t"<<(i+1)<<advGame[i].menu<<endl;
  113.      cout<<endl<<"================================================================================"<<endl;
  114. }
  115. //======================================================================================================
  116. void selectMenu(int no_menu)
  117. {
  118.      if(no_menu==1)
  119.           newGame();
  120.      else if(no_menu==2)
  121.           guideline();
  122.      else if(no_menu==3)
  123.           credit();
  124.      else if(no_menu==4)
  125.      {     cout<<endl<<" GAME EXIT"<<endl<<endl;
  126.            picture();
  127.      }
  128.      else
  129.      {
  130.         cin.clear(); // reset the state bits back to goodbit so we can use ignore()
  131.         cin.ignore(1000, \'\\n\'); // clear out the bad input from the stream
  132.         cerr<<" -> Wrong number entered"<<endl;
  133.         system("PAUSE");
  134.         displayMenu(advGame);    //display game menu
  135.         cout<<"\\n Enter Number: ";             //choose menu
  136.         cin>>no_menu;
  137.         system("cls");
  138.         selectMenu(no_menu); //recursive function
  139.       }
  140. }
  141. //======================================================================================================
  142. void newGame()
  143. {
  144.  int mode;
  145.     system("cls");
  146.   cout<<endl<<endl<<endl<<"  SELECT M0DE:"<<endl<<endl<<endl<<"\\t1) Single Player\\t[P1]"<<endl<<endl<<"\\t2) Multi Player\\t\\t[P1 VS P2]"<<endl;
  147.     cout<<endl<<endl<<" Enter Mode: ";
  148.     cin>>mode;
  149.          
  150.     if(mode==1)
  151.     {    cout<<endl<<endl<<" SINGLE PLAYER MODE"<<endl;
  152.          cout<<" -------------------"<<endl;
  153.          cout<<"\\n\\t ENTER NAME (without space): ";
  154.          cin>>user[0].P1name;
  155.          cout << endl;
  156.          system("PAUSE");
  157.          S_player();
  158.     }
  159.     else if(mode==2)
  160.     {    cout<<endl<<endl<<" MULTI PLAYER MODE"<<endl;
  161.          cout<<endl<<"\\t ENTER NAME (without space): "<<endl;
  162.          cout<<endl<<"\\t P1\\t: ";
  163.          cin>>user[0].P1name;
  164.          cout<<endl<<"\\t P2\\t: ";
  165.          cin>>user[0].P2name;
  166.          cout << endl<<endl;
  167.          system("PAUSE");
  168.          M_player();
  169.     }
  170.     else
  171.     {
  172.     cout<<" -> Wrong mode entered"<<endl;
  173.     system("PAUSE");
  174.     cin.clear(); // reset the state bits back to goodbit so we can use ignore()
  175.     cin.ignore(1000, \'\\n\'); // clear out the bad input from the stream
  176.     newGame();
  177.     }
  178. }
  179. //======================================================================================================
  180. void guideline()
  181. {
  182.  cout << "\\n GAME GUIDELINE:"<<endl;
  183.     cout << " ---------------"<<endl;
  184.     wait(0.5);
  185.  cout << endl<<" SPACE ADVENTURE:"<<endl<<endl<<" 1) Best played when the window are maximised (full screen)." << endl << endl; wait(0.2);
  186.     cout << " 2) There are two modes available: Single Player and Multiplayer. Multiplayer"<<endl<<"    allows two players to play in the same round of the game, by taking turns." <<endl;wait(0.2);
  187.     cout << endl<<" 3) Involves moving around the space grids from START until END using a dice to"<<endl<<"    randomise the steps."<<endl<<endl<<" 4) There will be 4 elements: Questions, Portal, Resting Place and Battle."<<endl << endl; wait(0.2);
  188.     cout << endl<<" 5) GAME ELEMENT:" <<endl;wait(0.5);
  189.     cout << endl<<"    i) Questions:"<<endl;wait(0.2);
  190.     cout << endl<<"    => Various questions will be asked and player(s) must correctly answer the"<<endl<<"       questions before continue with the journey."<<endl;wait(0.2);
  191.     cout << endl<<"    => Questions are accompanied by 4 choices of answer, and player only need"<<endl<<"       to enter A, B, C or D." << endl;wait(0.2);
  192.     cout << endl<<"    => When player answer the question correctly, the game will continue. Else,"<<endl<<"       player will ask with different question until player answer correctly."<< endl;wait(0.2);
  193.     cout << endl<<"    => Player may get same question if player didn\'t answer correctly."<<endl<<"       Questions that was answered correctly will not appear again." << endl;wait(0.2);
  194.     cout << endl; wait(0.2);
  195.     cout << endl<<"   ii) Portal:" <<endl;wait(0.2);
  196.     cout << endl<<"    => Player(s) may encounter portal that will send player(s) back or forth"<<endl<<"       randomly using dice number."<<endl;wait(0.2);
  197.     cout << endl; wait(0.2);
  198.     cout << endl<<"  iii) Resting Place:" <<endl;wait(0.2);
  199.     cout << endl<<"    => This is a place where you can rest a bit and heal some HP." <<endl;wait(0.2);
  200.     cout << endl; wait(0.2);
  201.     cout << endl<<"   iv) Battle:" << endl;wait(0.2);
  202.     cout << endl<<"    => Player(s) may encounter enemy that trying to stops the player from"<<endl<<"       continuing with the journey."<<endl<<endl<<"    => You start with 20HP, 20MP. You can attack, use force or heal.Using"<<endl<<"       force and heal require MP, so keep your MP in check before using it."<<endl<<endl<<"    => Death from battle [HP=0] will result in GAME OVER."<<endl<<endl<<"    => Player(s) WIN if enemy [HP=0] and can continue the game."<<endl;wait(0.2);
  203.  cout << endl<<endl;
  204.     system("PAUSE");
  205.  system("cls");
  206.     displayMenu(advGame);
  207.     cout<<" Enter Number: ";             //choose menu
  208.     cin>>no_menu;
  209.     system("cls");
  210.     selectMenu(no_menu);
  211. }
  212. //======================================================================================================
  213. void credit()
  214. {    cout <<endl<<endl<<" CREDITS:" << endl; wait(0.2);
  215.      cout << " --------"<<endl;
  216.      cout <<endl<<" Thanks for teachings, supports and suggestions from everyone: Our parents,"; wait(0.1);
  217.      cout <<endl<<endl<<" families, Puan Azlina Narawi(Lecturer of CSC 138, our current lecturer),"; wait(0.1);
  218.      cout << endl<<endl<<" Miss Adeline Engkamat(Lecturer of CSC 128), Puan Zubaidah Bohari"; wait(0.1);
  219.      cout << endl<<endl<<" (Lecturer of CSC118), fellow classmates, and everyone that contributes. " << endl; wait(0.5);
  220.      cout << endl<<endl<<endl<<" Credits to:"<<endl<<endl<<" => www.usefultrivia.com"; wait(0.1);
  221.      cout << endl<<endl<<" => www.cplusplus.happycodings.com"; wait(0.1);
  222.      cout << endl<<endl<<" => http://www.daniweb.com/forums/"; wait(0.1);
  223.      cout << endl<<endl<<" => http://www.dreamincode.net/"; wait(0.1);
  224.      cout << endl<<endl<<" => http://www.learncpp.com/"; wait(0.1);
  225.      cout << endl<<endl<<" => Other resources as references in completing this mini-project." << endl;wait(0.5);
  226.      cout << endl<<endl<<endl<<" ABOUT GAME:" << endl; wait(0.2);
  227.      cout << " -----------"<<endl;
  228.      cout << endl<<" This two (2) dimensional game has been created by 2 UiTM student (Diploma in"; wait(0.1);
  229.      cout << endl<<endl<<" Computer Science) named; Muhammad Azri bin Jasni (@zrI) and his friend,"; wait(0.1);
  230.      cout << endl<<endl<<" Mohd Zabiedy bin Mohd Sulaiman (ZomBiedy)."; wait(0.1);
  231.      cout << endl<<endl<<endl<<" The game has been done as an mini-project for CSC 138 - Structured Programming"; wait(0.1);
  232.      cout << endl<<endl<<" during Semester July - September 2010. One of the objective of this"; wait(0.1);
  233.      cout << endl<<endl<<" assignment is to determine whether computer science (part 2) understand the"; wait(0.1);
  234.      cout << endl<<endl<<" concept of Structured Programming,its component and also know how is applying"; wait(0.1);
  235.      cout << endl<<endl<<" them focused on multiple dimension array in C++." << endl; wait(0.2);
  236.      cout << endl<<endl;
  237.      system("PAUSE");
  238.      system("cls");
  239.      displayMenu(advGame);
  240.      cout<<" Enter Number: ";             //choose menu
  241.      cin>>no_menu;
  242.      system("cls");
  243.      selectMenu(no_menu);
  244. }
  245.  
  246. //======================================================================================================
  247. void S_player()
  248. {
  249.      system("cls");
  250.      GameStart(1);  
  251.      displayMenu(advGame);
  252.      cout<<" Enter Number: ";             //choose menu
  253.      cin>>no_menu;
  254.      system("cls");
  255.      selectMenu(no_menu);
  256. }
  257. //======================================================================================================
  258. void M_player()
  259. {
  260.      system("cls");
  261.    GameStart(2);  
  262.      system("cls");
  263.      displayMenu(advGame);
  264.      cout<<" Enter Number: ";             //choose menu
  265.      cin>>no_menu;
  266.      system("cls");
  267.      selectMenu(no_menu);  
  268. }
  269. //======================================================================================================
  270. //starting of game
  271. void GameStart(int player)
  272. {
  273.  int no_menu,turn;
  274.  intBoard();
  275.  intgame_element();
  276.  initializeQuestion ();
  277.     system("cls");
  278.     cout<<endl<<" GAME START !!!...GOOD LUCK"<<endl;                                 //initialize board
  279.     displayBoard();
  280.     if (player==2)
  281.     {
  282.        turn=1;
  283.        current_i2=0,current_j2=0;
  284.        while (strcmp(world.board[row-1][col-1],"  P 1  ")!=0||strcmp(world.board[row-1][col-1],"  P 2  ")!=0)
  285.        {
  286.              if (turn==1)
  287.              {
  288.                 goto labelsingle;
  289.              }
  290.              else if (turn ==2)
  291.              {
  292.                   cout<<endl<<" PLAYER 2: "<<user[0].P2name<<endl;
  293.                   cout<<endl<<" Press any key to roll the dice...";
  294.                   getch();                                                     //display board
  295.                   step=dice();                               //get dice value and save as step
  296.                   system("cls");
  297.                   slowstepsBoard2(step);
  298.                   cout<<endl<<" Your dice value: "<<step<<endl;
  299.                   switch (world.game_element[current_i2][current_j2])
  300.                   {
  301.                          case 1:
  302.                               cout<<endl<<" RESTING PLACE:"<<endl;
  303.                               rest(turn);
  304.                               break;
  305.                          case 2:
  306.                               cout<<endl<<" QUESTION:"<<endl;
  307.                               question();
  308.                               break;
  309.                          case 3:
  310.                               cout<<endl<<" PORTAL:"<<endl;
  311.                               portal(turn);
  312.                               break;
  313.                          case 4:
  314.                               cout<<endl<<" BATTLE:"<<endl;
  315.                               battle(turn);
  316.                               world.board[(current_i2)][(current_j2)]="  P 2  ";
  317.                               cout << endl;
  318.                               break;
  319.                   }
  320.                   world.board[current_i][current_j]="  P 1  ";
  321.                   world.board[current_i2][current_j2]="  P 2  ";
  322.                   }
  323.                   labelreturn:
  324.  
  325.                   if (strcmp(world.board[row-1][col-1],"  P 1  ")==0)
  326.                   {   break;}
  327.                   else if (strcmp(world.board[row-1][col-1],"  P 2  ")==0)
  328.                   {   break;}
  329.                   //turn change
  330.                   if (turn==1)
  331.                        turn =2;
  332.                   else if (turn==2)
  333.                        turn=1;
  334.              }              
  335.        }
  336.        else
  337.        {
  338.              turn = 0;
  339.              while(strcmp(world.board[8][7],"  P 1  ")!=0)
  340.              {
  341.                   labelsingle:
  342.                   cout<<endl<<" PLAYER 1: "<<user[0].P1name<<endl;
  343.                   cout<<endl<<" Press any key to roll the dice...";
  344.                   getch();                                                     //display board
  345.                   step=dice();                               //get dice value and save as step
  346.                   system("cls");
  347.                   slowstepsBoard(step);                          //move P1 on board according to the step
  348.                   //display dice value
  349.                   cout<<endl<<" Your dice value: "<<step<<endl;
  350.                   switch (world.game_element[current_i][current_j])
  351.                   {
  352.                          case 1:
  353.                               cout<<endl<<" RESTING PLACE:"<<endl;
  354.                               rest(turn);
  355.                               break;
  356.                          case 2:
  357.                               cout<<endl<<" QUESTION:"<<endl;
  358.                               question();
  359.                               break;
  360.                          case 3:
  361.                               cout<<endl<<" PORTAL:"<<endl;
  362.                               portal(turn);
  363.                               break;
  364.                          case 4:
  365.                               cout<<endl<<" BATTLE:"<<endl;
  366.                               battle(turn);
  367.                               world.board[(current_i)][(current_j)]="  P 1  ";
  368.                               if((player==2))
  369.                                     world.board[current_i2][current_j2]="  P 2  ";
  370.                               cout << endl;
  371.                               displayBoard();
  372.                               break;
  373.                   }//switch
  374.                   if(turn == 1) {goto labelreturn;}
  375.              }//while
  376.        }//else
  377.        win(turn);
  378.        if(turn==2)
  379.             cout<<endl<<endl<<" CONGRATULATION !!!.."<<user[0].P2name<<" Finish The Game...\\n See You Again..Thank You."<<endl<<"\\n <= Back to Game Menu "<<endl;
  380.        else if(turn==1)
  381.             cout<<endl<<endl<<" CONGRATULATION !!!.."<<user[0].P1name<<" Finish The Game...\\n See You Again..Thank You."<<endl<<"\\n <= Back to Game Menu "<<endl;
  382.        cout<<endl;
  383.        system("PAUSE");
  384.        system("cls");
  385.        main();
  386.        /*
  387.        displayMenu(advGame);
  388.        cout<<" Enter Number: ";             //choose menu
  389.        cin>>no_menu;
  390.        system("cls");
  391.        selectMenu(no_menu);*/
  392. }
  393.  
  394. //======================================================================================================
  395. //dice function
  396. int dice(void)
  397. {
  398.     return rand() % 6 + 1;
  399. }
  400. //======================================================================================================
  401. //initialize board
  402. void intBoard(void)
  403. {
  404.     for(i=0;i<row;i++)
  405.      for(j=0;j<col;j++)
  406.              world.board[i][j]="       ";
  407.     world.board[0][0]=" START ";
  408.     world.board[row-1][col-1]="  END  ";
  409.     current_i=0; current_j=0;
  410.     if (player==2)
  411.         current_i2=0; current_j2=0;
  412. }
  413. //======================================================================================================
  414. //initialize game_element
  415. void intgame_element(void)
  416. {
  417.      for (i=0;i<row;i++)
  418.          for (j=0;j<col;j++)
  419.         {
  420.              int countLimitBattle=0;
  421.              int countLimitRest=0;
  422.              world.game_element[i][j]=rand() % 4 + 1;
  423.              label4:
  424.              if (world.game_element[i][j]==1)
  425.              {
  426.                 if (countLimitRest==LimitRest)
  427.                 {
  428.                      world.game_element[i][j]=rand() % 4 + 1;
  429.                      goto label4;
  430.                 }
  431.                 else
  432.                     countLimitRest++;
  433.              }
  434.              label3:
  435.              if (world.game_element[i][j]==4)
  436.              {
  437.                 if (countLimitBattle==LimitBattle)
  438.                 {
  439.                      world.game_element[i][j]=rand() % 4 + 1;
  440.                      goto label3;
  441.                 }
  442.                 else
  443.                     countLimitBattle++;
  444.              }
  445.          }
  446.  world.game_element[row-1][col-1]=0; world.game_element[0][0]=0;
  447. }
  448. //======================================================================================================
  449. //show game board
  450. void displayBoard(void)
  451. {
  452.      world.board[0][0]=" START ";
  453.      wait(0.2);
  454.   for(i=0;i<row;i++)
  455.      {    cout<<endl;
  456.        for(j=0;j<(col);j++)
  457.                cout<<"========";
  458.           cout<<endl<<\'|\';
  459.           if (i%2==1)
  460.              for(j=(col-1);j>=0;j--)
  461.                  cout<<world.board[i][j]<<\'|\';
  462.           else
  463.          for(j=0;j<col;j++)
  464.              cout<<world.board[i][j]<<\'|\';
  465.      }
  466.      cout<<endl;
  467.      for(j=0;j<(col);j++)
  468.          cout<<"========";
  469.      cout<<endl;
  470. }
  471. //======================================================================================================
  472. //stepping around board-slow motion
  473. void slowstepsBoard(int step)
  474. {
  475.      //new code
  476.      
  477.      for (int count=0;count<=step;count++,current_j++)
  478.      {
  479.          if(player==2)
  480.                   {world.board[current_i2][current_j2]="  P 2  ";}
  481.          system("cls");
  482.          if (current_i==row||(current_i==row&&current_j==col))//when reach destination or over it, assign to
  483.          {
  484.               world.board[current_i][current_j]="       ";
  485.               world.board[8][7]="  P 1  ";   //last destination and break out of loop
  486.               displayBoard();
  487.               break;
  488.          }
  489.          if (current_j>=col)
  490.          {
  491.         current_j=current_j-col;
  492.               current_i++;
  493.          }
  494.          world.board[current_i][current_j]="  P 1  ";
  495.          displayBoard();
  496.          wait(0.15);
  497.          world.board[current_i][current_j]="       ";
  498.      }//for
  499.      current_j--;
  500. }
  501. //======================================================================================================
  502. //to slow down the display of the board
  503. void wait(float seconds)
  504. {
  505.      //error converting clock_t from float
  506.      //error didn\'t seems to affect gameplay
  507.   clock_t endwait;
  508.   endwait=clock()+seconds*CLOCKS_PER_SEC;
  509.   while(clock()<endwait){}   // jarak antara nombor yang akan dipaparkan
  510. }
  511. //======================================================================================================
  512. //resting function
  513. void rest(int turn)
  514. {
  515.      //random comments in resting place element
  516.      int randRest = (rand() % 4 + 1);
  517.      switch (randRest)
  518.      {
  519.             case 1:
  520.                  cout << " => You found a space cafe and decided to have a popular\\n    Universe Water before proceed with your adventure."<<endl;
  521.                  break;
  522.             case 2:
  523.                  cout << " => You gazes at the beautiful starry scene in front of you\\n    before continuing your journey." <<endl;
  524.                  break;
  525.             case 3:
  526.                  cout << " => You land on space rock to repair your space ship." <<endl;
  527.                  break;
  528.             case 4:
  529.                  cout << " => You stop for a while to take space picture." <<endl;
  530.                  break;
  531.      }
  532.      
  533.      if (turn==2)
  534.      {
  535.           hp2+=10; //resting increase hp
  536.           if (hp2>100)
  537.              hp2=100;
  538.           cout << "\\n --------------------------"<< endl;
  539.           cout << "  Increase HP by 10.\\n  Current HP2   : " << hp2 << endl;
  540.           cout << " --------------------------"<< endl;
  541.      }//if
  542.      else if (turn==1||turn==0)
  543.      {
  544.           hp+=10; //resting increase hp
  545.           if (hp>100)
  546.              hp=100;
  547.           cout << "\\n --------------------------"<< endl;
  548.           cout << "  Increase HP by 10.\\n  Current HP   : " << hp << endl;
  549.           cout << " --------------------------"<< endl;
  550.      }//else
  551. }
  552. //======================================================================================================
  553. //portal function
  554. void portal(int turn)
  555. {
  556.      cout << " => You get sucked in into a WORMHOLE.\\n    It sends you somewhere around the universe." << endl;
  557.          
  558.      int polarity=(rand() % 2 + 1);
  559.      if (polarity==2)
  560.           step=dice();
  561.      else
  562.           step=(-1)*dice();
  563.          
  564.      cout <<endl<<endl;
  565.      system("PAUSE");
  566.      system("cls");
  567.      if (turn==2)
  568.      {
  569.           world.board[(current_i2)][(current_j2)]="       ";
  570.           current_j2=current_j2+step;
  571.           if (current_j2>=col)
  572.           {
  573.                 current_j2=current_j2-col;
  574.               current_i2++;
  575.           }
  576.           world.board[(current_i2)][(current_j2)]="  P 2  ";
  577.      }
  578.      else
  579.      {
  580.           world.board[(current_i)][(current_j)]="       ";
  581.           current_j=current_j+step;
  582.           if (current_j>=col)
  583.           {
  584.                 current_j=current_j-col;
  585.                 current_i++;
  586.           }
  587.           world.board[(current_i)][(current_j)]="  P 1  ";
  588.      }
  589.      cout<<" After sucked: "<<endl;
  590.      displayBoard();
  591.      
  592. }
  593. //======================================================================================================
  594. //battle mode = battle()+win()+lose()
  595. int battle(int turn)
  596. {
  597.     if (turn==2)
  598.     {hp2+=1; //for first battle, hp will be 20. every next battle, hp increase by 1 simulating hp regeneration
  599.     ehp=30;
  600.     labelbattle2:
  601.     mp2++; //mp regeneration
  602.    
  603.     cout << "\\n -----------------------------------------------------" << endl;
  604.     cout << "   ENEMY HP\\t: "<<setw(5)<<setiosflags(ios::right)<< ehp << "\\t\\t(1) Attack"<<endl<< "   "<<user[0].P2name<<" HP\\t: "
  605.          <<setw(5)<<setiosflags(ios::right)<<  hp2 << "\\t\\t(2) Use Force[10MP2]" << endl<< "   "<<user[0].P2name<<" MP\\t: " <<setw(5)<<setiosflags(ios::right)<<  mp2 << "\\t\\t(3) Heal[2MP2]"<< endl;
  606.     cout << " -----------------------------------------------------\\n Enter Number: ";
  607.     cin >> move;
  608.     system("cls");
  609.     if (move>=1&&move<=3)
  610.     { cout << "\\n STATUS: " << endl; wait(0.2);
  611.         switch (move)
  612.         {
  613.             case 1:
  614.                 if ((rand() % 3 + 1)==1)
  615.                    {cout<<"\\n -> You PUNCHED your enemy on his face . [ehp-1]"<<endl; ehp-=1;}
  616.                 else if ((rand() % 3 + 1)==2)          
  617.                    {cout<<"\\n -> You shot him from distance using RIFLE. [ehp-2]"<<endl; ehp-=2;}
  618.                 else
  619.                    {cout<<"\\n -> You sliced him with your DRAGON SWORD. [ehp-3]"<<endl; ehp-=3;}
  620.                 break;
  621.             case 2:
  622.                 if (mp2>=10)
  623.                 {
  624.                    int a=(rand() % 5 + 1);
  625.                    cout<<"\\n -> You used your force and pushed him back, hurting\\n    him in the process. [ehp-"<<a<<",mp2-10]"<<endl;
  626.                    ehp-=a;
  627.                    mp2-=10;
  628.                 }
  629.                 else
  630.                 {
  631.                     cout<<"\\n -> You don\'t have enough MP to use your force ability."<<endl;
  632.                 }
  633.                 break;
  634.             case 3:
  635.                 if (mp2>=2)
  636.                 {
  637.                 cout<<"\\n -> You patched yourself quickly in the midst of battle.[hp2+4,mp2-2]"<<endl;
  638.                 hp2+=4;
  639.                 mp2-=2;
  640.                     if (hp2>100)
  641.                        hp2=100;
  642.                 }
  643.                 else
  644.                 {
  645.                     cout<<"\\n -> You don\'t have enough MP to heal yourself."<<endl;
  646.                 }
  647.             }//switch(move)
  648.             wait(0.2);
  649.         if (ehp<=0)
  650.         {  
  651.             win(turn);
  652.             return 1;
  653.         }
  654.         else
  655.         {
  656.              emove=(rand() % 3 + 1);
  657.              wait(0.2);
  658.              if (emove==1)
  659.              {   cout << "\\n -> The enemy shot you using his LASER RIFLE. [hp2-1]" << endl; hp2-=1;}
  660.              else if (emove==2)          
  661.              {   cout << "\\n -> The enemy charged at you and pushed you onto the space rock.[hp2-2]" <<endl; hp2-=2;}
  662.              else if (emove==3)
  663.              {   cout << "\\n -> The enemy HEALED himself. [ehp+2]"<<endl; ehp+=2;}
  664.              wait(0.2);
  665.         }
  666.     if (hp2<=0)
  667.     {   lose(turn);
  668.         return 0;}
  669.     }//if (1<move<3)
  670.     else
  671.     {
  672.         cin.clear(); // reset the state bits back to goodbit so we can use ignore()
  673.         cin.ignore(1000, \'\\n\'); // clear out the bad input from the stream
  674.         move=0;
  675.         cerr<<" -> Wrong input. Enter 1,2 or 3 only"<<endl;
  676.         wait(0.2);
  677.         system("PAUSE");cout<<endl;
  678.         system("cls");}
  679.         goto labelbattle2;
  680.     }//if
  681.     else
  682.         {
  683.             hp+=1; //for first battle, hp will be 20. every next battle, hp increase by 1 simulating hp regeneration
  684.             ehp=30;
  685.             label:
  686.             mp++; //mp regeneration
  687.    
  688.             cout << "\\n -----------------------------------------------------" << endl;
  689.             cout << "   ENEMY HP\\t: "<<setw(5)<<setiosflags(ios::right)<< ehp << "\\t\\t(1) Attack"<<endl<< "   "<<user[0].P1name<<" HP\\t: "
  690.                   <<setw(5)<<setiosflags(ios::right)<<  hp << "\\t\\t(2) Use Force[10MP1]" << endl<< "   "<<user[0].P1name<<" MP\\t: " <<setw(5)<<setiosflags(ios::right)<<  mp << "\\t\\t(3) Heal[2MP1]"<< endl;
  691.             cout << " -----------------------------------------------------\\n Enter Number: ";
  692.            
  693.             cin >> move;
  694.             system("cls");
  695.             if (move>=1&&move<=3)
  696.             { cout << "\\n STATUS: "<< endl; wait(0.2);
  697.                 switch (move)
  698.                 {
  699.                        case 1:
  700.                             if ((rand() % 3 + 1)==1)
  701.                                  {cout<<"\\n -> You PUNCHED your enemy on his face . [ehp-1]"<<endl; ehp-=1;}
  702.                             else if ((rand() % 3 + 1)==2)          
  703.                                  {cout<<"\\n -> You shot him from distance using RIFLE. [ehp-2]"<<endl; ehp-=2;}
  704.                             else
  705.                                  {cout<<"\\n -> You sliced him with your DRAGON SWORD. [ehp-3]"<<endl; ehp-=3;}
  706.                             break;
  707.                        case 2:
  708.                             if (mp>=10)
  709.                             {
  710.                                int a=(rand() % 5 + 1);
  711.                                cout<<"\\n -> You used your force and pushed him back,hurting\\n    him in the process.[ehp-"<<a<<",mp-10]"<<endl;
  712.                                ehp-=a;
  713.                                mp-=10;
  714.                             }
  715.                             else
  716.                             {
  717.                                 cout<<"\\n -> You don\'t have enough MP to use your force ability."<<endl;
  718.                             }
  719.                             break;
  720.                        case 3:
  721.                             if (mp>=2)
  722.                             {
  723.                                cout<<"\\n -> You patched yourself quickly in the midst of battle.[hp+4,mp-2]"<<endl;
  724.                                hp+=4;
  725.                                mp-=2;
  726.                                if (hp>100)
  727.                                   hp=100;
  728.                             }
  729.                             else
  730.                                cout<<"\\n -> You don\'t have enough MP to heal yourself."<<endl;
  731.                 }//switch(move)
  732.                 wait(0.2);
  733.                 if (ehp<=0)
  734.                 {   win(turn); return 1;}
  735.                 else
  736.                 {          
  737.                            emove=(rand() % 3 + 1);
  738.                            wait(0.2);
  739.                            if (emove==1)
  740.                            {   cout << "\\n -> The enemy shot you using his LASER RIFLE.[hp-1]" << endl; hp-=1;}
  741.                            else if (emove==2)          
  742.                            {   cout << "\\n -> The enemy charged at you and pushed you onto the space rock.[hp-2]" <<endl; hp-=2;}
  743.                            else if (emove==3)
  744.                            {   cout << "\\n -> The enemy HEALED himself. [ehp+2]"<<endl; ehp+=2;}
  745.                            wait(0.2);
  746.                 }
  747.                 if (hp<=0)
  748.                 {   lose(turn);
  749.                     return 0;}
  750.             }//if (1<move<3
  751.             else
  752.             {
  753.                 cin.clear(); // reset the state bits back to goodbit so we can use ignore()
  754.                 cin.ignore(1000, \'\\n\'); // clear out the bad input from the stream
  755.                  move=0;
  756.                 cerr<<" -> Wrong input. Enter 1,2 or 3."<<endl;
  757.                 wait(0.2);
  758.                 system("PAUSE");cout<<endl;
  759.                 system("cls");}
  760.                 goto label;
  761.             }//else
  762.     }
  763. //======================================================================================================
  764. //win()
  765. void win(int turn)
  766. {
  767.      if (player==2)
  768.      {
  769.         switch (turn)
  770.         {          
  771.         case 1:
  772.         cout<<endl<<"\\n "<<user[0].P1name<<" WIN!" << endl; break;
  773.         case 2:
  774.         cout<<endl<<"\\n "<<user[0].P2name<<" WIN!" << endl; break;
  775.         }
  776.      }
  777.      else
  778.       cout<<endl<<"\\n "<<user[0].P1name<<" WIN!" << endl;          //winner by name displayed
  779.      cout << endl;
  780.      system("PAUSE");
  781.      system("cls");
  782.      
  783. }
  784. //======================================================================================================
  785. //lose()
  786. void lose(int turn)
  787. {
  788.      cout<<endl<<"\\n GAME OVER" << endl;
  789.      if (player==2)
  790.      {
  791.         switch(turn)
  792.         {           case 2:
  793.                          cout<<"\\n "<<user[0].P1name<<" Win, "<<user[0].P2name<<" Lose";break;    //cout<<"PLAYER 1 Win, PLAYER 2 Lose"; break;
  794.                     case 1:
  795.                          cout<<"\\n "<<user[0].P2name<<" Win, "<<user[0].P1name<<" Lose";break;    //cout<<"PLAYER 2 Win, PLAYER 1 Lose"; break;  
  796.         }
  797.      }
  798.      cout << endl;
  799.      system("PAUSE");
  800.      system("cls");
  801.      main();
  802. }
  803. //======================================================================================================
  804. //question functions-question(),initializeQuestion(),initializeStatus()
  805. int question (void)
  806. {
  807.     while(1)
  808.     {
  809.          //label2:
  810.          int randomQuestion=( (rand()) % size_question); //randomize the questions
  811.          if (questions[randomQuestion].status==1)
  812.                    continue;//goto label2;
  813.             char answer;
  814.          cout<<questions[randomQuestion].q<<endl;
  815.          cout<<"\\n Your answer: ";
  816.          cin>>answer;
  817.          answer=toupper(answer);
  818.          if (answer == questions[randomQuestion].ans)//...
  819.          { cout<<endl<<" -> That\'s correct!"<<endl; questions[randomQuestion].status=1;
  820.                 return 1;
  821.             }
  822.          else
  823.           cout<<endl<<" -> That\'s wrong..."<<endl;
  824.          system("Pause");
  825.             system("cls");}
  826.  //goto label2;
  827. }
  828. //=================================================
  829. //list of questions
  830. void initializeQuestion (void)
  831. {
  832.  questions[0].q="\\n There are many theories about the birth of our solar system. Which theory\\n involves a passing star pulling dust and debris from the forming sun?\\n\\tA: Nebular Hypothesis\\n\\tB: Tidal Theory\\n\\tC: Collision Theory\\n\\tD: Protoplanet Hypothesis";
  833.  questions[0].ans=\'B\';
  834.  questions[1].q="\\n The planets make up what percentage of the mass in our solar system?\\n\\tA: 0.0135 %\\n\\tB: 0.135 %\\n\\tC: 1.35 %\\n\\tD: 13.5 %";
  835.  questions[1].ans=\'B\';
  836.   questions[2].q="\\n What are the only two planets in our solar system without moons?\\n\\tA: Mercury & Venus\\n\\tB: Venus & Mars\\n\\tC: Uranus & Neptune\\n\\tD: Neptune & Pluto";
  837.  questions[2].ans=\'A\';
  838.  questions[3].q="\\n What is the name of Pluto\'s moon?\\n\\tA: Charon\\n\\tB: Phobus\\n\\tC: Pandora\\n\\tD: Nereid";
  839.  questions[3].ans=\'A\';
  840.  questions[4].q="\\n The three main parts of a comet are the nucleus, the tail, and the _____?\\n\\tA: Zenith\\n\\tB: Umbra\\n\\tC: Radiant\\n\\tD: Coma";
  841.  questions[4].ans=\'D\';
  842.  questions[5].q="\\n What year boasted the first woman in space?\\n\\tA: 1963\\n\\tB: 1968\\n\\tC: 1973\\n\\tD: 1983";
  843.  questions[5].ans=\'A\';
  844.  questions[6].q="\\n What is the term for the condition when three celestial bodies are arranged\\n in a straight line?\\n\\tA: Occultation\\n\\tB: Parallax\\n\\tC: Syzygy\\n\\tD: Triple Transit";
  845.  questions[6].ans=\'C\';
  846.  questions[7].q="\\n Which of the following was discovered in 2002?\\n\\tA: Nereid\\n\\tB: Varuna\\n\\tC: Titan\\n\\tD: Quaoar";
  847.  questions[7].ans=\'D\';
  848.  questions[8].q="\\n What manned U.S. space program eventually put 12 men on the Moon?\\n\\tA: Apollo\\n\\tB: Gemini\\n\\tC: Mercury\\n\\tD: Voyager";
  849.  questions[8].ans=\'A\';
  850.  questions[9].q="\\n From 1978 to 1999, which planet was farthest from the Sun?\\n\\tA: Pluto\\n\\tB: Neptune\\n\\tC: Uranus\\n\\tD: Saturn";
  851.  questions[9].ans=\'B\';
  852.  questions[10].q="\\n What was the very first personal computer?\\n\\tA: TRS-80\\n\\tB: Commodore PET\\n\\tC: Kenbak-1\\n\\tD: Apple I";
  853.  questions[10].ans=\'C\';
  854.  questions[11].q="\\n What year was the word \\"computer\\" first used to describe\\n a mechanical calculating device?\\n\\tA: 1897\\n\\tB: 1912\\n\\tC: 1926\\n\\tD: 1942";
  855.     questions[11].ans=\'A\';
  856.  questions[12].q="\\n What was the first portable computer?\\n\\tA: Epson HX-20\\n\\tB: Cray I\\n\\tC: Osborne I\\n\\tD: IBM 5155";
  857.     questions[12].ans=\'C\';
  858.  questions[13].q="\\n During the 1970s computer engineers at various research institutions\\n began to utilize telecommunications technologies to link their computers\\n together. This effort, the forefather of the modern Internet, was known as the ...\\n\\tA: INSTANET\\n\\tB: ARPANET\\n\\tC: ORDONET\\n\\tD: BAYONET";
  859.     questions[13].ans=\'B\';
  860.  questions[14].q="\\n What was the first computer to defeat a world champion chess player?\\n\\tA: Chinook\\n\\tB: X3D Fritz\\n\\tC: Deep Blue\\n\\tD: A.L.I.C.E.";
  861.     questions[14].ans=\'C\';
  862.  questions[15].q="\\n What computer device did Douglas Engelbart invent in 1963?\\n\\tA: Modem\\n\\tB: Mouse\\n\\tC: Floppy disk\\n\\tD: Microchip";
  863.     questions[15].ans=\'B\';
  864.  questions[16].q="\\n What \\"law\\" describes the fact that, on average, computers\\n doubled in capacity every 18 to 24 months since 1900?\\n\\tA: Anderson\'s Law\\n\\tB: Moore\'s Law\\n\\tC: Jefferson\'s Law\\n\\tD: Bohr\'s Law";
  865.     questions[16].ans=\'B\';
  866.  questions[17].q="\\n How many lines of code did the Windows 98 operating system contain?\\n\\tA: 4 million\\n\\tB: 9 million\\n\\tC: 18 million\\n\\tD: 40 million";
  867.     questions[17].ans=\'C\';
  868.  questions[18].q="\\n What was the first commercially successful vector processor?\\n\\tA: Cray I\\n\\tB: HP-2115\\n\\tC: Altair 8800\\n\\tD: Apple I";
  869.     questions[18].ans=\'A\';
  870.  questions[19].q="\\n What new product did Apple Computer launch with a $1.5 million\\n commercial during the 1984 Super Bowl?\\n\\tA: Apple I\\n\\tB: Apple IIe\\n\\tC: Apple IIc\\n\\tD: Macintosh";
  871.     questions[19].ans=\'D\';
  872.  questions[20].q="\\n Mt. Fuji is the highest point in what Asian country?\\n\\tA: Bangladesh\\n\\tB: Burma\\n\\tC: China\\n\\tD: Japan";
  873.     questions[20].ans=\'D\';
  874.  questions[21].q="\\n What is western Asia\'s longest river?\\n\\tA: Tigris\\n\\tB: Euphrates\\n\\tC: Xi Jiang\\n\\tD: Kurobe";
  875.     questions[21].ans=\'B\';
  876.  questions[22].q="\\n What tiny country, known to its inhabitants as Druk Yul(Land of\\n the Thunder Dragon), is sandwiched between China and India?\\n\\tA: Bhutan\\n\\tB: Bangladesh\\n\\tC: Mongolia\\n\\tD: Burma";
  877.     questions[22].ans=\'A\';
  878.  questions[23].q="\\n What mountain range runs along the northern border of India?\\n\\tA: Urul Mountains\\n\\tB: Tatra Mountains\\n\\tC: Xiao Hinggan Ling Mountains\\n\\tD: Himalayan Mountains";
  879.     questions[23].ans=\'D\';
  880.  questions[24].q="\\n Korea is separated from Japan by what strait?\\n\\tA: Cheju\\n\\tB: Tsushima\\n\\tC: Gibraltar\\n\\tD: Bungo";
  881.     questions[24].ans=\'B\';
  882.  questions[25].q="\\n What Chinese city is situated at the mouth of the Chang Jiang (Yangtze) River?\\n\\tA: Shanghai\\n\\tB: Beijing\\n\\tC: Taipei\\n\\tD: Changchun";
  883.     questions[25].ans=\'A\';
  884.  questions[26].q="\\n What is the tallest mountain in Asia?\\n\\tA: Qogir\\n\\tB: Kangchenjunga\\n\\tC: Cho Oyu\\n\\tD: Mount Everest";
  885.     questions[26].ans=\'D\';
  886.  questions[27].q="\\n Iran is slightly larger than what U.S. state?\\n\\tA: Rhode Island\\n\\tB: Montana\\n\\tC: Texas\\n\\tD: Alaska";
  887.     questions[27].ans=\'D\';
  888.  questions[28].q="\\n What Japanese city is the site of the Peace Memorial Park\\n and the eternal Peace Flame which is never to be extinguished\\n until all nuclear weapons are dismantled?\\n\\tA: Hiroshima\\n\\tB: Nagasaki\\n\\tC: Tokyo\\n\\tD: Kyoto";
  889.     questions[28].ans=\'A\';
  890.  questions[29].q="\\n What is the capital of Afghanistan?\\n\\tA: Teheran\\n\\tB: Kandahar\\n\\tC: Baghdad\\n\\tD: Kabul";
  891.     questions[29].ans=\'D\';
  892.     questions[30].q="\\n When was the idea of the atom first introduced?\\n\\tA: 450 B.C.\\n\\tB: 1050\\n\\tC: 1791\\n\\tD: 1942";
  893.     questions[30].ans=\'A\';
  894.     questions[31].q="\\n In 2004, what was discovered on the island of Flores\\n in Indonesia?\\n\\tA: A living dinosaur\\n\\tB: Remains of a hobbit-sized human species\\n\\tC: A tribe whose members commonly live over 150 years\\n\\tD: A plant with a mammal-like brain";
  895.     questions[31].ans=\'B\';
  896.     questions[32].q="\\n An earthquake that measures 8 on the Richter Scale would\\n be how many times stronger than an earthquake that\\n measures 4 on the same scale?\\n\\tA: 2 times stronger\\n\\tB: 4 times stronger\\n\\tC: 1000 times stronger\\n\\tD: 10,000 times stronger";
  897.     questions[32].ans=\'D\';
  898.     questions[33].q="\\n What is the gestation period of an Hippopotamus?\\n\\tA: 4 months\\n\\tB: 8 months\\n\\tC: 12 months\\n\\tD: 16 months";
  899.     questions[33].ans=\'B\';
  900.     questions[34].q="\\n What physicist discovered that a wave\'s frequency changes\\n when the source and the observer are in motion relative\\n to one another?\\n\\tA: Max Planck\\n\\tB: Christian Doppler\\n\\tC: Enrico Fermi\\n\\tD: Albert Einstein";
  901.     questions[34].ans=\'B\';
  902.     questions[35].q="\\n In what type of matter are atoms most tightly packed?\\n\\tA: Solids\\n\\tB: Liquids\\n\\tC: Gases\\n\\tD: All are the same";
  903.     questions[35].ans=\'A\';
  904.     questions[36].q="\\n Which of the following means \\"rain\\" when added to\\n a cloud\'s name?\\n\\tA: Alto\\n\\tB: Nimbus\\n\\tC: Strato\\n\\tD: Cirrus";
  905.     questions[36].ans=\'B\';
  906.     questions[37].q="\\n What is the longest river in the world?\\n\\tA: Amazon\\n\\tB: Nile\\n\\tC: Congo\\n\\tD: Chang Jiang";
  907.     questions[37].ans=\'B\';
  908.     questions[38].q="\\n How many brains did a Stegosaurus have?\\n\\tA: One\\n\\tB: Two\\n\\tC: Three\\n\\tD: None";
  909.     questions[38].ans=\'A\';
  910.     questions[39].q="\\n What instrument is used to measure wind speed?\\n\\tA: Anemometer\\n\\tB: Barometer\\n\\tC: Altimeter\\n\\tD: Fanometer";
  911.     questions[39].ans=\'A\';
  912.  questions[40].q="\\n What is Earth\'s largest continent?\\n\\tA: Asia\\n\\tB: Africa\\n\\tC: Europe\\n\\tD: Antarctica";
  913.     questions[40].ans=\'A\';
  914.     questions[41].q="\\n What razor-thin country accounts for more than half of the western coastline of South America?\\n\\tA: Ecuador\\n\\tB: Chile\\n\\tC: Peru\\n\\tD: Bolivia";
  915.     questions[41].ans=\'B\';
  916.     questions[42].q="\\n What river runs through Baghdad?\\n\\tA: Tigris\\n\\tB: Euphrates\\n\\tC: Karun\\n\\tD: Jordan";
  917.     questions[42].ans=\'C\';
  918.     questions[43].q="\\n What country is home to Kangaroo Island?\\n\\tA: Australia\\n\\tB: France\\n\\tC: Japan\\n\\tD: Great Britain";
  919.     questions[43].ans=\'A\';
  920.     questions[44].q="\\n What continent is located at Latitude 90° S Longitude 0.00° E?\\n\\tA: South America\\n\\tB: Asia\\n\\tC: Australia\\n\\tD: Antarctica";
  921.     questions[44].ans=\'A\';
  922.     questions[45].q="\\n What is the largest country in South America?\\n\\tA: Columbia\\n\\tB: Argentina\\n\\tC: Brazil\\n\\tD: Peru";
  923.     questions[45].ans=\'C\';
  924.     questions[46].q="\\n What is the tallest mountain in the world?\\n\\tA: Aconcagua\\n\\tB: Qogir\\n\\tC: Mount Kilimanjaro\\n\\tD: Mount Everest";
  925.     questions[46].ans=\'D\';
  926.     questions[47].q="\\n What city is the capital of Australia?\\n\\tA: Perth\\n\\tB: Melbourne\\n\\tC: Sydney\\n\\tD: Canberra";
  927.     questions[47].ans=\'D\';
  928.     questions[48].q="\\n Riyadh is the capital of what Middle-Eastern country?\\n\\tA: Iraq\\n\\tB: Syria\\n\\tC: Saudi Arabia\\n\\tD: Yemen";
  929.     questions[48].ans=\'C\';
  930.     questions[49].q="\\n Which of these African nations is NOT landlocked?\\n\\tA: Niger\\n\\tB: Congo\\n\\tC: Chad\\n\\tD: Burkina Faso";
  931.     questions[49].ans=\'B\';
  932.     questions[50].q="\\n What is the earliest surviving system of laws?\\n\\tA: Rosetta Stone\\n\\tB: Code of Hammurabi\\n\\tC: Hebrew Torah\\n\\tD: Shabaka Stone";
  933.     questions[50].ans=\'B\';
  934.     questions[51].q="\\n What type of gun did John Wilkes Booth use to assassinate U.S. President Abraham Lincoln?\\n\\tA: Derringer Pistol\\n\\tB: Colt Peacemaker\\n\\tC: Smith & Wesson Revolver\\n\\tD: Winchester Rifle";
  935.     questions[51].ans=\'A\';
  936.     questions[52].q="\\n What was the last battle of the Napoleonic Wars?\\n\\tA: Battle of Trafalgar\\n\\tB: Battle of the Nile\\n\\tC: Battle of Wavre\\n\\tD: Battle of Waterloo";
  937.     questions[52].ans=\'C\';
  938.     questions[53].q="\\n The world\'s first postage stamp was introduced in what year?\\n\\tA: 1690\\n\\tB: 1760\\n\\tC: 1840\\n\\tD: 1910";
  939.     questions[53].ans=\'C\';
  940.     questions[54].q="\\n Who was the first democratically elected President of Russia?\\n\\tA: Mikhail Gorbachev\\n\\tB: Boris Yeltsin\\n\\tC: Vladimir Putin\\n\\tD: Nikita Khrushchev";
  941.     questions[54].ans=\'B\';
  942.     questions[55].q="\\n Which of the following inventions was the first to be patented?\\n\\tA: Chewing Gum\\n\\tB: Dishwasher\\n\\tC: Cash Register\\n\\tD: Rubber Band";
  943.     questions[55].ans=\'A\';
  944.     questions[56].q="\\n When the first Burger King Restaurant opened in 1954, how much did a hamburger cost?\\n\\tA: 9 cents\\n\\tB: 18 cents\\n\\tC: 37 cents\\n\\tD: 50 cents";
  945.     questions[56].ans=\'B\';
  946.     questions[57].q="\\n What was the first city to reach a population of one million?\\n\\tA: Rome\\n\\tB: London\\n\\tC: New York\\n\\tD: Beijing";
  947.     questions[57].ans=\'A\';
  948.     questions[58].q="\\n How long did the Hundred Years\' War last?\\n\\tA: 86 years\\n\\tB: 99 years\\n\\tC: 100 years\\n\\tD: 116 years";
  949.     questions[58].ans=\'D\';
  950.     questions[59].q="\\n Who was the first Prime Minister of the United Kingdom?\\n\\tA: Henry Pelham\\n\\tB: Robert Walpole\\n\\tC: George Grenville\\n\\tD: Winston Churchill";
  951.     questions[59].ans=\'B\';
  952.     questions[60].q="\\n What European country consists of a boot-shaped peninsula surrounded by four seas?\\n\\tA: Norway\\n\\tB: Sweden\\n\\tC: Italy\\n\\tD: Greece";
  953.     questions[60].ans=\'C\';
  954.     questions[61].q="\\n What country is geographically separated from continental Europe by the Pyrenees mountains?\\n\\tA: Spain\\n\\tB: France\\n\\tC: Italy\\n\\tD: Croatia";
  955.     questions[61].ans=\'A\';
  956.     questions[62].q="\\n What is Europe\'s longest river?\\n\\tA: Rhine\\n\\tB: Loire\\n\\tC: Volga\\n\\tD: Thames";
  957.     questions[62].ans=\'C\';
  958.     questions[63].q="\\n What European country is bordered by Slovakia, Ukraine, Romania, Serbia, Croatia, Slovenia, and Austria?\\n\\tA: Bulgaria\\n\\tB: Hungary\\n\\tC: Russia\\n\\tD: France";
  959.     questions[63].ans=\'B\';
  960.     questions[64].q="\\n Germany is divided into how many states?\\n\\tA: 8\\n\\tB: 16\\n\\tC: 24\\n\\tD: 32";
  961.     questions[64].ans=\'B\';
  962.     questions[65].q="\\n Poland is situated on the southern end of what sea?\\n\\tA: Aegean Sea\\n\\tB: Black Sea\\n\\tC: Baltic Sea\\n\\tD: Norwegian Sea";
  963.     questions[65].ans=\'C\';
  964.     questions[66].q="\\n What river begins in the Black Forest region of Germany, flows across central Europe and the countries of Austria, Hungary, Croatia, and Yugoslavia, and empties into the Black Sea?\\n\\tA: Seine\\n\\tB: Danube\\n\\tC: Oder\\n\\tD: Elbe";
  965.     questions[66].ans=\'B\';
  966.     questions[67].q="\\n What is the capital of Lithuania?\\n\\tA: Valmiera\\n\\tB: Taurage\\n\\tC: Vilnius\\n\\tD: Riga";
  967.     questions[67].ans=\'C\';
  968.     questions[68].q="\\n What is the tallest mountain in Europe?\\n\\tA: Mount Corno\\n\\tB: Mount Elbrus\\n\\tC: Mount Olympus\\n\\tD: Mount Blanc";
  969.     questions[68].ans=\'B\';
  970.     questions[69].q="\\n What is the highest inhabited country in Europe?\\n\\tA: Andorra\\n\\tB: Liechtenstein\\n\\tC: Croatia, D: Switzerland";
  971.     questions[69].ans=\'A\';
  972.     initializeStatus ();
  973. }  
  974.  
  975. void initializeStatus (void)
  976. {
  977.      for ( i=0; i<size_question; i++)
  978.      questions[i].status=0;
  979. }
  980. //======================================================================================================
  981. //stepping around board player 2
  982. void slowstepsBoard2(int step)
  983. {
  984.      //new code
  985.      world.board[current_i2][current_j2]="       ";
  986.      for (int count=0;count<=step;count++,current_j2++)
  987.      {
  988.          
  989.          system("cls");
  990.          if (current_i2==row||(current_i2==row&&current_j2==col))//when reach destination or over it, assign to
  991.          {
  992.          world.board[current_i2][current_j2]="       ";
  993.          world.board[8][7]="  P 2  ";   //last destination and break out of loop
  994.          world.board[current_i][current_j]="  P 1  ";
  995.          displayBoard();
  996.          break;
  997.          }
  998.          if (current_j2>=col)
  999.          {
  1000.    current_j2=current_j2-col;
  1001.        current_i2++;
  1002.          }
  1003.          world.board[current_i2][current_j2]="  P 2  ";
  1004.          world.board[current_i][current_j]="  P 1  ";
  1005.          displayBoard();
  1006.          world.board[current_i2][current_j2]="       ";
  1007.          wait(0.2);
  1008.      }//for
  1009.      current_j2--;
  1010. }
  1011. //======================================================================================================
  1012.  
  1013. void picture()
  1014. {
  1015.      cout<<"\\t ________            _______"<<endl<<"\\t|        |          /       |"<<endl<<"\\t| ###### |         / ###### /"<<endl;
  1016.   cout<<"\\t| ###### |        / ###### /"<<endl<<"\\t| ###### |       / ###### /"<<endl<<"\\t| ###### |      / ###### /"<<endl;
  1017.   cout<<"\\t| ###### |     / ###### /"<<endl<<"\\t| ###### |    / ###### /"<<endl<<"\\t| ###### |   / ###### /"<<endl;
  1018.   cout<<"\\t| ###### |  / ###### /"<<endl<<"\\t| ###### | / ###### /"<<endl<<"\\t| ###### |   #####    -----    ----"<<endl;
  1019.   cout<<"\\t| ###### | #######  / #####| | ####|"<<endl<<"\\t| ###### | ######   / #####| | #####|"<<endl;
  1020.   cout<<"\\t| ###### | ######  / ######| | #####|"<<endl<<"\\t| ###### | ####   / ###### // ##### /"<<endl;
  1021.   cout<<"\\t| ###### | ####  | ###### // ##### /"<<endl<<"\\t| ###### | ##    \\\\ ##### // ##### /"<<endl;
  1022.      cout<<"\\t| ____________________    #### /"<<endl<<"\\t|/  ,,,,,,,,,,,,,,,,  \\\\;...; /"<<endl;
  1023.   cout<<"\\t|  ##############:\'\'\':| ----"<<endl<<"\\t|  ##############:   :|     !!!!!!!!!!!!!!!!   !!!!!!!!"<<endl;
  1024.   cout<<"\\t|  ##############:...:|     !!!!!!!!!!!!!!!!  !!!!!!!!!!"<<endl<<"\\t ;====================/          !!! !;      !!!      !!!"<<endl;
  1025.      cout<<"\\t|| +++++++++++++++++++++++ ||    !!! !;      !!!      !!!"<<endl<<"\\t|| #####################  |||    !!! !;      !!!      !!!"<<endl;
  1026.      cout<<"\\t||  *******************  ///     !!! !;      !!!      !!!"<<endl<<"\\t||                      ||       !!! !;      !!!      !!!"<<endl;
  1027.      cout<<"\\t||                     ||;       !!! !;      !!!   ;;.!!!"<<endl<<"\\t\\t\\t\\t\\t !!! !;       !!!!!!!!!!"<<endl;
  1028.      cout<<"\\t\\t\\t\\t\\t \\"\\"\\"\\"\\"\\"        !!!!!!\\"!!!"<<endl<<"\\t\\t\\t\\t\\t\\t\\t       !!\'"<<endl;
  1029.  
  1030. }
');