int main() {
srand(time(0));
vector<Card> deck;
vector<Card> foundation;
vector<vector<Card>> tableau(7);
// Initialize deck and deal initial cards
initializeDeck(deck);
dealInitialCards(tableau, deck);
while (true) {
printLayout(tableau, foundation, deck);
int choice;
cout << "Choose an action: 1) Move between piles 2) Move to foundation 3) Draw card: ";
cin >> choice;
if (choice == 3) {
drawCard(deck, wastePile);
} else if (choice == 2) {
int fromPile;
cout << "Enter tableau pile number to move from (1-7): ";
cin >> fromPile;
--fromPile;
if (!tableau[fromPile].empty() && moveToFoundation(foundation, tableau[fromPile].back())) {
tableau[fromPile].pop_back();
} else {
cout << "Invalid move to foundation.\n";
}
} else if (choice == 1) {
// Handle tableau-to-tableau moves as already implemented
}
cout << "Enter the pile number to move from (1-7): ";
int fromPile;
cin >> fromPile;
fromPile--;
cout << "Enter the pile number to move to (1-7): ";
int toPile;
cin >> toPile;
toPile--;
if (fromPile >= 0 && fromPile < 7 && toPile >= 0 && toPile < 7 && !tableau[fromPile].empty()) {
if (isValidMove(tableau, fromPile, toPile, tableau[fromPile].back())) {
makeMove(tableau, fromPile, toPile);
} else {
cout << "Invalid move. Try again.\n";
}
} else {
cout << "Invalid input. Try again.\n";
}
if (isGameWon(foundation)) {
cout << "Congratulations! You won the game!\n";
break;
}
}
return 0;
}