-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhumano.h
100 lines (88 loc) · 1.99 KB
/
humano.h
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#ifndef HUMANO_H_INCLUDED
#define HUMANO_H_INCLUDED
#include <cmath>
#include <string>
#include <map>
#include <vector>
#include <iomanip>
#include <iostream>
#include <list>
#include"player.h"
class human : public player{
public:
human(string name, deck);
card play_card(int i);
int ask_truco(bool);
int acept_refuse_truco(bool);
int give_up(bool);
int get_id();
int get_size();
void atualizar_jogador(deck);
std::string get_name();
bool is_a_bot();
private:
std::string name;
int id; // Referencia o bot com um ID
static int robot_numbers; //Numero de bots no jogo
};
human::human(std::string name, deck a){
this->name = name;
this->pontos = 0;
this->quedas = 0;
is_bot = false;
human::atualizar_jogador(a);
}
void human::atualizar_jogador(deck a){
this->quedas = 0;
if(criacao_jogador_atual == 1){
player_hand = a.Hand_player_1;
}
if(criacao_jogador_atual == 2){
player_hand = a.Hand_player_2;
}
if(criacao_jogador_atual == 3){
player_hand = a.Hand_player_3;
}
if(criacao_jogador_atual == 4){
player_hand = a.Hand_player_4;
criacao_jogador_atual = 1;
}
criacao_jogador_atual++;
}
card human::play_card(int i){
if (i < 0 || i >= player_hand.size()) {
throw invalid_argument("Você não possui essa carta na mão.");
}
card carta = player_hand[i];
player_hand[i] = player_hand[player_hand.size()-1];
player_hand.pop_back();
return carta;
}
int human::ask_truco(bool pedir_truco){
if(pedir_truco == true){
return 1;
}
return 0;
}
int human::acept_refuse_truco(bool aceitar_truco){
if(aceitar_truco == true){
return 1;
}
return 0;
}
int human::get_id(){
return this->id;
}
int human::give_up(bool desistir){
if(desistir == true){
return 1;
}
return 0;
}
int human::get_size() {
return this->player_hand.size();
}
std::string human::get_name() {
return this->name;
}
#endif