Advertisement
Guest User

Untitled

a guest
Feb 26th, 2013
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.23 KB | None | 0 0
  1. #include<iostream>
  2. #include<stdlib.h>
  3. #include<string>
  4. #include<iomanip>
  5. using namespace std;
  6. struct card {
  7.     int rightside;
  8.     int leftside;
  9.     int upside;
  10.     int downside;
  11.     bool side;
  12.     string name;
  13. };
  14. int numberofcardsally = 6;
  15. int numberofcardsenemy = 6;
  16. bool fullboard = false;
  17. int main() {
  18.     card deck[6];
  19.     card edeck[6]
  20.     int input;
  21.     int randomcardpick = rand() % 10;
  22.     srand(time(0));
  23.     card board[3][3];
  24.     card cards[10];
  25.     cards[0].rightside = 4;
  26.     cards[0].leftside = 6;
  27.     cards[0].upside = 2;
  28.     cards[0].downside = 3;
  29.     cards[0].name = "Grdl";
  30.     cards[0].side = true;
  31.     cards[1].rightside = 6;
  32.     cards[1].leftside = 6;
  33.     cards[1].upside = 3;
  34.     cards[1].downside = 2;
  35.     cards[1].name = "Tmbry";
  36.     cards[1].side = true;
  37.     cards[2].rightside = 7;
  38.     cards[2].leftside = 1;
  39.     cards[2].upside = 3;
  40.     cards[2].downside = 9;
  41.     cards[2].name = "Edea";
  42.     cards[2].side = true;
  43.     cards[3].rightside = 3;
  44.     cards[3].leftside = 6;
  45.     cards[3].upside = 3;
  46.     cards[3].downside = 9;
  47.     cards[3].name = "Shva";
  48.     cards[3].side = true;
  49.     cards[4].rightside = 2;
  50.     cards[4].leftside = 8;
  51.     cards[4].upside = 4;
  52.     cards[4].downside = 6;
  53.     cards[4].name = "Ifrt";
  54.     cards[4].side = true;
  55.     cards[5].rightside = 5;
  56.     cards[5].leftside = 3;
  57.     cards[5].upside = 7;
  58.     cards[5].downside = 1;
  59.     cards[5].name = "King";
  60.     cards[5].side = true;
  61.     cards[6].rightside = 3;
  62.     cards[6].leftside = 8;
  63.     cards[6].upside = 9;
  64.     cards[6].downside = 2;
  65.     cards[6].name = "Jinn";
  66.     cards[6].side = true;
  67.     cards[7].rightside = 9;
  68.     cards[7].leftside = 4;
  69.     cards[7].upside = 2;
  70.     cards[7].downside = 2;
  71.     cards[7].name = "Kiro";
  72.     cards[7].side = true;
  73.     cards[8].rightside = 9;
  74.     cards[8].leftside = 4;
  75.     cards[8].upside = 6;
  76.     cards[8].downside = 6;
  77.     cards[8].name = "Ward";
  78.     cards[8].side = true;
  79.     cards[9].rightside = 4;
  80.     cards[9].leftside = 6;
  81.     cards[9].upside = 9;
  82.     cards[9].downside = 8;
  83.     cards[9].name = "Alex";
  84.     cards[9].side = true;
  85.     cards[10].rightside = 9;
  86.     cards[10].leftside = 9;
  87.     cards[10].upside = 9;
  88.     cards[10].downside = 9;
  89.     cards[10].name = "Ulma";
  90.     cards[10].side = true;
  91.     card cardse[10];
  92.     cardse[0].rightside = 4;
  93.     cardse[0].leftside = 6;
  94.     cardse[0].upside = 2;
  95.     cardse[0].downside = 3;
  96.     cardse[0].name = "Grdl";
  97.     cardse[0].side = true;
  98.     cardse[1].rightside = 6;
  99.     cardse[1].leftside = 6;
  100.     cardse[1].upside = 3;
  101.     cardse[1].downside = 2;
  102.     cardse[1].name = "Tmbry";
  103.     cardse[1].side = true;
  104.     cardse[2].rightside = 7;
  105.     cardse[2].leftside = 1;
  106.     cardse[2].upside = 3;
  107.     cardse[2].downside = 9;
  108.     cardse[2].name = "Edea";
  109.     cardse[2].side = true;
  110.     cardse[3].rightside = 3;
  111.     cardse[3].leftside = 6;
  112.     cardse[3].upside = 3;
  113.     cardse[3].downside = 9;
  114.     cardse[3].name = "Shva";
  115.     cardse[3].side = true;
  116.     cardse[4].rightside = 2;
  117.     cardse[4].leftside = 8;
  118.     cardse[4].upside = 4;
  119.     cardse[4].downside = 6;
  120.     cardse[4].name = "Ifrt";
  121.     cardse[4].side = true;
  122.     cardse[5].rightside = 5;
  123.     cardse[5].leftside = 3;
  124.     cardse[5].upside = 7;
  125.     cardse[5].downside = 1;
  126.     cardse[5].name = "King";
  127.     cardse[5].side = true;
  128.     cardse[6].rightside = 3;
  129.     cardse[6].leftside = 8;
  130.     cardse[6].upside = 9;
  131.     cardse[6].downside = 2;
  132.     cardse[6].name = "Jinn";
  133.     cardse[6].side = true;
  134.     cardse[7].rightside = 9;
  135.     cardse[7].leftside = 4;
  136.     cardse[7].upside = 2;
  137.     cardse[7].downside = 2;
  138.     cardse[7].name = "Kiro";
  139.     cardse[7].side = true;
  140.     cardse[8].rightside = 9;
  141.     cardse[8].leftside = 4;
  142.     cardse[8].upside = 6;
  143.     cardse[8].downside = 6;
  144.     cardse[8].name = "Ward";
  145.     cardse[8].side = true;
  146.     cardse[9].rightside = 4;
  147.     cardse[9].leftside = 6;
  148.     cardse[9].upside = 9;
  149.     cardse[9].downside = 8;
  150.     cardse[9].name = "Alex";
  151.     cardse[9].side = true;
  152.     cardse[10].rightside = 9;
  153.     cardse[10].leftside = 9;
  154.     cardse[10].upside = 9;
  155.     cardse[10].downside = 9;
  156.     cardse[10].name = "Ulma";
  157.     cardse[10].side = true;
  158.     for(int x = 0; x < 3; x++) {
  159.         for(int y = 0; y < 3; y++)
  160.         board[x][y].name = "    ";
  161.     }
  162.         cout << "Select your cards: \n";
  163.         for(int i = 0; i < 10; i++) {
  164.             cout << i << ": " << cards[i].name << endl;
  165.         }
  166.         for(int i = 0; i < 6; i++) {
  167.             cin >> input;
  168.             deck[i].name = cards[input].name;
  169.             deck[i].rightside = cards[input].rightside;
  170.             deck[i].rightside = cards[input].leftside;
  171.             deck[i].upside = cards[input].upside;
  172.             deck[i].downside = cards[input].downside;
  173.             deck[i].side = true;
  174.         }
  175.         for(int i = 0; i < 6; i++) {
  176.             randomcardpick = rand() % 10;
  177.             edeck[i].name = cardse[randomcardpick].name;
  178.             edeck[i].rightside = cardse[randomcardpick].rightside;
  179.             edeck[i].leftside = cardse[randomcardpick].leftside;
  180.             edeck[i].upside = cardse[randomcardpick].upside;
  181.             edeck[i].downside = cardse[randomcardpick].downside;
  182.             edeck[i].side = false;
  183.         }
  184.     while(true) {
  185.         for(int i = 0; i <= 40; i++) {
  186.             cout << endl;
  187.         }
  188.         if(numberofcardsally >= numberofcardsenemy && fullboard == 1) {
  189.             cout << "You won!\n";
  190.             cin.get();
  191.             cin.get();
  192.             exit(0);
  193.         } else {
  194.             cout << "You lost!\n";
  195.             cin.get();
  196.             cin.get();
  197.             exit(0);
  198.         }
  199.         for(int i = 0; i < 6; i++) {
  200.             cout << setw(100) << cards[i].name;
  201.         }
  202.         for(int i = 0; i < 6; i++) {
  203.             cout << setw(30) << cardse[i].name;
  204.         }
  205.         for(int x = 3; x < 3; x++) {
  206.             for(int y = 3; y < 3; y++)
  207.             cout << "[" << board[x][y].name << "]";
  208.             cout << endl;
  209.         }
  210.         cout << "Which card do you want to use? ";
  211.         cin >> input;
  212.     }
  213. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement