Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cstdlib>
- #include<string>
- #include<iomanip>
- using namespace std;
- struct card {
- int Top;
- int Left;
- int Right;
- int Bottom;
- bool Side;
- string CardName;
- // Struct constructor to easier initialization
- card(string cardName, int top, int left, int right, int bottom, bool side)
- {
- CardName = cardName;
- Top = top;
- Left = left;
- Right = right;
- Bottom = bottom;
- Side = side;
- }
- card() { } // Default constructor
- };
- const int numberofcardsally = 6;
- const int numberofcardsenemy = 6;
- bool fullboard = false;
- int x;
- int y;
- int main() {
- card PlayerDeck[6];
- card EnemyDeck[6];
- card board[3][3];
- int input;
- // Remember to srand() before using rand()!
- srand(time(0));
- // Creating cards individually
- card PlayerCards[11];
- PlayerCards[0] = card("Grdl", 2, 6, 4, 3, true);
- PlayerCards[1] = card("Tmbry", 3, 6, 6, 2, true);
- PlayerCards[2] = card("Edea", 3, 1, 7, 9, true);
- PlayerCards[3] = card("Shva", 3, 6, 3, 9, true);
- PlayerCards[4] = card("Ifrt", 4, 8, 2, 6, true);
- PlayerCards[5] = card("King", 7, 3, 5, 1, true);
- PlayerCards[6] = card("Jinn", 9, 8, 3, 2, true);
- PlayerCards[7] = card("Kiro", 2, 4, 9, 2, true);
- PlayerCards[8] = card("Ward", 6, 4, 9, 6, true);
- PlayerCards[9] = card("Alex", 9, 6, 4, 8, true);
- PlayerCards[10] = card("Ulma", 9, 9, 9, 9, true);
- // Simpler way to do it
- card EnemyCards[11] = {
- card("Grdl", 2, 6, 4, 3, true), card("Tmbry", 3, 6, 6, 2, true), card("Edea", 3, 1, 7, 9, true), card("Shva", 3, 6, 3, 9, true), card("Ifrt", 4, 8, 2, 6, true),
- card("King", 7, 3, 5, 1, true), card("Jinn", 9, 8, 3, 2, true), card("Kiro", 2, 4, 9, 2, true), card("Ward", 6, 4, 9, 6, true), card("Alex", 9, 6, 4, 8, true),
- card("Ulma", 9, 9, 9, 9, true)
- };
- // Initialize board to blank
- for(int x = 0; x < 3; x++)
- {
- for(int y = 0; y < 3; y++)
- board[x][y].CardName = " ";
- }
- cout << "Select your cards: \n";
- for(int i = 0; i < 11; i++)
- cout << i << ": " << PlayerCards[i].CardName << endl;
- for(int i = 0; i < 6; i++)
- {
- cin >> input;
- PlayerDeck[i] = PlayerCards[input];
- }
- for(int i = 0; i < 6; i++)
- EnemyDeck[i] = EnemyCards[rand() % 11]; // Random from 0 to 10
- while(true)
- {
- for(int i = 0; i <= 40; i++)
- cout << endl;
- // Will never make it past this if-else
- if((numberofcardsally >= numberofcardsenemy) && fullboard) {
- cout << "You won!\n";
- cin.get();
- cin.get();
- exit(0);
- }
- if((numberofcardsally <= numberofcardsenemy) && fullboard) {
- cout << "You lost!\n";
- cin.get();
- cin.get();
- exit(0);
- }
- for(int i = 0; i < 6; i++) {
- cout << PlayerDeck[i].CardName << endl;
- cout << setw(300) << EnemyDeck[i].CardName << endl;
- }
- for(int x = 3; x < 3; x++) {
- for(int y = 3; y < 3; y++)
- cout << "[" << board[x][y].CardName << "]";
- cout << endl;
- }
- cout << "Which card do you want to use? ";
- cin >> input;
- cout << "Position: X Y ";
- cin >> x >> y;
- board[x][y] = PlayerDeck[input];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement