-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
57 lines (46 loc) · 1.65 KB
/
main.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
#include <iostream>
#include <ctime>
#include <exception>
#include "network/Server.h"
#include "network/OnlineRoom.h"
#include "pokerGame/Game.h"
#include "pokerGame/GameContext.h"
#include "pokerGame/GameRound.h"
#include "pokerGame/card/Deck.h"
#include "pokerGame/BettingRound.h"
#include "playerController//BotPlayerController.h"
#include "playerController/bot/SimpleBettingStrategy.h"
#include "playerController/bot/ProbabilisticBettingStrategy.h"
#include "pokerGame/card/HandStrengthEvaluator.h"
#include "pokerGame/simulation/PreFlopSimulator.h"
#include "playerController/bot/AgressiveBettingStrategy.h"
#include "boost/thread/thread.hpp"
void initRandom();
void runServer() {
pokerGame::GameContext* gameContext = new pokerGame::GameContext(2);
pokerGame::card::Deck* deckToUse = new pokerGame::card::Deck();
pokerGame::BettingRound* bettingRoundToUse = new pokerGame::BettingRound();
pokerGame::GameRound* gameRoundToUse = new pokerGame::GameRound(deckToUse, bettingRoundToUse);
pokerGame::Game* room = new pokerGame::Game(gameContext, gameRoundToUse);
network::Server ts((network::OnlineRoom*) room);
ts.initService(); //function does not return.
while (true) {
boost::this_thread::sleep(boost::posix_time::millisec(1000));
if (room->getNumberOfPlayers() == 2)
room->start();
}
}
void runPreFlopSimulation() {
pokerGame::simulation::PreFlopSimulator simulator;
simulator.simulate();
}
int main(int argc, char** argv) {
initRandom();
runServer();
return 0;
}
/* This function is critical for RNG */
void initRandom()
{
std::srand(time(nullptr));
}