-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGameEngine.cpp
66 lines (48 loc) · 1.11 KB
/
GameEngine.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
#include "stdafx.h"
#include "GameEngine.h"
#include <limits>
using namespace std;
GameEngine::GameEngine() {
game = new Game();
}
GameEngine::~GameEngine() {
delete game;
}
void GameEngine::playGame() {
cout << endl;
int playerMode;
while (true) {
cout << " Do you want to play Single mode or Tournament ??" << endl;
cout << " 1) Single Mode" << endl;
cout << " 2) Tournament Mode" << endl;
cin >> playerMode;
if (cin.fail()) {
cin.clear();
cin.ignore(numeric_limits<streamsize>::max(), '\n');
}
if (playerMode > 0 && playerMode < 3) {
break;
}
}
cout << endl;
MapLoader* mapLoader = new MapLoader();
mapLoader->loadMap();
//Create the Game
Game* game = new Game();
game->setMap(mapLoader->getMap());
game->setPlayerMode(playerMode);
Phase* phase = new Phase();
game->addSubscriber(phase);
//Create Deck and Shuffle
game->createDeck();
game->loadPlayer();
game->setObserver();
game->setStartingGameCountry();
game->if2Players();
game->playerBid();
//Main hand
game->draw6cards();
game->showDeckHand();
game->startGame();
game->computeScoreG();
}