-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDriver.cpp
28 lines (24 loc) · 1.04 KB
/
Driver.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
#include "CommandProcessing.h"
#include "GameEngine.h"
#include <iostream>
using namespace std;
int main(){
LogObserver* lo = new LogObserver();
GameEngine* myGame; // create a new game
myGame = new GameEngine(); // initialize the game
myGame->attach(lo);
CommandProcessor* processor = myGame->getCommandProcessor();
list<Command>* commandList = processor->getCommandList(); // get the command of gameengine from its commandprocessor object
myGame->get_all_map_commands();
for (Command& command : *commandList) {
command.attach(lo);
processor->validate(myGame, &command);
}
if(processor->tournament_mode){
cout << "Game Result:" << *myGame->getResult() <<endl;
}
//prevent memory leak:
delete myGame;
delete lo;
return 0;
}