-
Notifications
You must be signed in to change notification settings - Fork 8
/
Player.cpp
83 lines (82 loc) · 2.14 KB
/
Player.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
83
#include<iostream>
#include<time.h>
#include<math.h>
#include<vector>
#include"Human.cpp"
#include"Counting.h"
using namespace std;
class Player : public Human{
public:
Player(int initial_wager, int initial_sidebet_wager);
void create_hand(DeckOfCard doc, Card initial_card);
void add_money(double amount);
void add_sidebet_money(double amount);
int get_wager();
double get_money();
int get_sidebet_wager();
double get_sidebet_money();
void set_wager(int new_wager);
void modify_bet_by_count(double current_count);
void set_betting_system(int index);
void modify_bet_by_betting_system();
bool win_previous_hand;
private:
double money;
int wager;
int sidebet_wager;
double sidebet_money;
int betting_unit;
int betting_system;
};
Player::Player(int unit_of_bet, int initial_sidebet_wager) : Human(){
money = 0;
betting_unit = unit_of_bet;
wager = betting_unit;
sidebet_wager = initial_sidebet_wager;
}
void Player::create_hand(DeckOfCard doc, Card initial_card){
Hand newHand(doc, get_wager(), initial_card);
hands.push_back(newHand);
}
void Player::add_money(double amount){
money += amount;
return;
}
void Player::add_sidebet_money(double amount){
sidebet_money += amount;
return;
}
double Player::get_money(){
return money;
}
void Player::set_betting_system(int index){
betting_system = index;
}
double Player::get_sidebet_money(){
return sidebet_money;
}
int Player::get_sidebet_wager(){
return sidebet_wager;
}
void Player::set_wager(int new_wager){
wager = new_wager;
}
int Player::get_wager(){
return wager;
}
void Player::modify_bet_by_betting_system(){
if(betting_system == 0){
if(win_previous_hand){
set_wager(20);
}else{
set_wager(10);
}
}
}
void Player::modify_bet_by_count(double current_count){
if(current_count >=0){
set_wager(betting_unit*positive_count[(int)floor(current_count)]);
}else{
set_wager(betting_unit*negative_count[abs((int)floor(-1*current_count))]);
}
}