-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGame.cpp
executable file
·51 lines (37 loc) · 1.68 KB
/
Game.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
#include "Game.h"
#include "Entities/DillerFactory.h"
#include "Entities/IDiller.h"
#include "Tools/ProbabilityMath.h"
#include "Entities/Player.h"
#include <QDebug>
Game::Game()
{
///NOTE: for test(remove if release)
std::shared_ptr<Entities::Round> round( new Entities::Round );
std::shared_ptr<Entities::Table> gameInfo( new Entities::Table );
gameInfo->TakePlace( 1, std::shared_ptr<Entities::Player>( new Entities::Player ) );
gameInfo->TakePlace( 2, std::shared_ptr<Entities::Player>( new Entities::Player ) );
gameInfo->TakePlace( 3, std::shared_ptr<Entities::Player>( new Entities::Player ) );
gameInfo->TakePlace( 4, std::shared_ptr<Entities::Player>( new Entities::Player ) );
round->SetGameInfo( gameInfo );
}
void Game::StartRound()
{
std::shared_ptr<Entities::Round> round( new Entities::Round );
auto gameInfo = ( _rounds.size() != 0 )
? _rounds.back()->GetGameInfo()
: std::shared_ptr<Entities::Table>( new Entities::Table );
round->SetGameInfo( gameInfo );
auto diller = Entities::DillerFactory::CreateDiller();
round->SetDiller( diller );
round->Start();
///NOTE: for test(remove if release)
round->Start();
auto hand = std::make_pair( Entities::Card( Entities::Rank::King, Entities::Suit::Clubs ),
Entities::Card( Entities::Rank::Ten, Entities::Suit::Clubs ) );
auto board = round->GetGameInfo()->GetBoard();
// board.push_back( Entities::Card( Entities::Rank::Two, Entities::Suit::Clubs ) );
auto coin = Tools::ProbabilityMath::CoinForMinusProbability( board, 150 );
auto ev = Tools::ProbabilityMath::CalculateEV( hand, board, 150 + 174 , 174 );
qDebug() << ev << "::" << "coin = " << coin;
}