-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcard_demo.cpp
158 lines (157 loc) · 4.7 KB
/
card_demo.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
//// FILE: card_demo.cpp
//// This is a small demonstration program showing how the Card and Deck classes are used.
//// Project Finished by Adrian Melo and David Fernandez
//#include <iostream> // Provides cout and cin
//#include <cstdlib> // Provides EXIT_SUCCESS
//#include "card.h"
//#include "player.h"
//#include "deck.h"
//
//using namespace std;
//
//// PROTOTYPES for functions used by this demonstration program:
//void dealHand(Deck &d, Player &p, int numCards);
//
//int main( ) {
// cout << pA.getName() << "'s Books: " << pA.showBooks() << " || Total Books:" << pA.getBookSize() << endl;
//
// cout << pB.getName() << "'s Books: " << pB.showBooks() << " || Total Books:" << pB.getBookSize() << endl;
//
// cout << pA.getName() << "'s Hand: " << pA.showHand() << " || Total:" << pA.getHandSize() << endl;
// cout << pB.getName() << "'s Hand: " << pB.showHand() << " || Total:" << pB.getHandSize() << endl;
//
// cout << "Main Deck Size: " << mainDeck.size() << endl;
//
// cout << "Total Cards:" << mainDeck.size()+(2*pA.getBookSize())+pA.getHandSize()+(2*pB.getBookSize())+pB.getHandSize()<< endl << endl;
//
// cout << "Main Deck Left:" << mainDeck.size() << endl;
//
// //SHOW DECK//
// int deckBound = mainDeck.size();
// for(int i = 0; i < deckBound ; i++){
// cout << mainDeck.dealCard() << ", ";
// }
//////////CARD TESTER//////////
//// Card testCard;
////
//// cout << testCard.toString() << endl;
////
//// Card testCard2(1, Card::spades);
////
//// cout << testCard2.toString() << endl;
////
//// if(testCard.sameSuitAs(testCard2)){
//// cout << "Same Suit" << endl;
//// }else{
//// cout << "Not Same Suit" << endl;
//// }
////
//// if(testCard==testCard2){
//// cout << "Same Card" << endl;
//// }else{
//// cout << "Not Same Card" << endl;
//// }
//
//
//////////DECK TESTER//////////
////Deck newDeck;
////
//// //Size Tester//
////cout << "There are " << newDeck.size() << " cards left in the deck" << endl << endl;
////
//// //Shuffle Tester
////newDeck.shuffle();
////
//// //SHOW DECK//
////for(int i = 0; i < 52; i++){
//// cout << newDeck.dealCard() << endl;
////}
////
//// //Size Edge case of 0 Tester //
////cout << "There are " << newDeck.size() << " cards left in the deck" << endl << endl;
//
//////////PLAYER TESTER//////////
//
// int numCards = 14;
//
// Player p1("Adrian");
// Player p2("David");
//
// Deck d; //create a deck of cards
//
// dealHand(d, p1, numCards);
// dealHand(d, p2, numCards);
//
// //cout debug statements
//
// cout << p1.getName()<< endl;
// cout << p2.getName()<< endl;
//
// cout << "Adrian's Hand: " << p1.showHand() << endl;
//
// cout << "Adrian's Cards in Hand: " << p1.getHandSize() << endl;
//
// cout << "Adrian's Cards in Book: " << p1.getBookSize() << endl;
//
// //Checking Pair and Booking the Card//
// //Check Hand Tester//
// Card* card1 = new Card();
// Card* card2 = new Card();
//
// if(p1.checkHandForBook(*card1, *card2)){
// cout << "Adrian has a pair!" << endl;
// } else{
// cout << "Adrian doesn't have a pair!" << endl;
// }
//
// //Book Cards Tester//
// p1.bookCards(*card1, *card2);
// cout << "Adrian's Book: " << p1.showBooks() << endl;
//
// //Remove Hand Tester//
// p1.removeCardFromHand(*card1);
// p1.removeCardFromHand(*card2);
// cout << "Adrian's Hand: " << p1.showHand() << endl;
//
// //Rank in Hand Tester//
// if(p1.rankInHand(Card(1,Card::spades))){
// cout << "Adrian has the rank!" << endl;
// }
// if(p1.cardInHand(Card(2,Card::spades))){
// cout << "Adrian has the card!" << endl;
// }
//
// //Have to create a function to iterate through the hand to check pairs to be able to book any pairs
// d.shuffle();
//
//////////DEMO TESTER//////////
//
//// int numCards = 5;
////
//// Player p1("Joe");
//// Player p2("Jane");
////
//// Deck d; //create a deck of cards
//// d.shuffle();
////
//// dealHand(d, p1, numCards);
//// dealHand(d, p2, numCards);
////
//// cout << p1.getName() <<" has : " << p1.showHand() << endl;
//// cout << p2.getName() <<" has : " << p2.showHand() << endl;
////
//// return EXIT_SUCCESS;
//}
//
//void dealHand(Deck &d, Player &p, int numCards)
//{
// for (int i=0; i < numCards; i++)
// p.addCard(d.dealCard());
//}
//
//
//
//
//
//
//