-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainCardGame.cpp
82 lines (56 loc) · 1.78 KB
/
mainCardGame.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
/*------------------------------------------------------------------------------------------------------------------------------------------
Simple Card game S
Written for summer course in c++
2014 Anna Dunblad
------------------------------------------------------------------------------------------------------------------------------------------*/
#include <iostream> //input/output
#include <ctime> //for time() used for initializing rand
#include <cstdlib> //for srand
#include "Card.h"
#include "Deck.h"
#include "Game.h"
int main(){
srand (time(0)); //initialize psuedo-random number generator with time of program starting
std::cout<< "Welcome to the card game! \nGame is starting...\nCreating deck of cards..."<<std::endl;
int choice;
Deck deck;
Game game(&deck);
while(1)
{
std::cout << "-------------------------------------"<<std::endl;
std::cout<<"Please choose between: "<<std::endl;
std::cout<<"1. New game \n2. Play (no shuffeling) \n3. See game score \n4. See used cards \n5. Print deck \n6. End game"<<std::endl;
std::cout << "-------------------------------------"<<std::endl;
std::cin>>choice;
switch(choice)
{
case 1:
std::cout<<"Shuffeling deck..."<<std::endl;
deck.currentCard=0;
game.resetGame();
deck.shuffleDeck();
game.play();
break;
case 2:
game.play();
break;
case 3:
game.printPosition();
break;
case 4:
deck.printDeckofDrawnCards();
break;
case 5:
deck.printDeck();
break;
case 6:
game.printWinner();
std::cout<<"Ending game";
return 0;
default:
std::cout<<"Not a valid input number"<<std::endl;
break;
}
}
return 0;
}