-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPioche.cpp
47 lines (37 loc) · 1.22 KB
/
Pioche.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
#include "Pioche.h"
//****************class Pioche*******************//
Carte* Pioche::piocher() {
unsigned int nb_cartes = getNbCartes();
//random entre 0 et le nombre de carte - 1
unsigned int random = rand() % (nb_cartes);
Carte& c = getCarte(random);
return retirerCarte(&c);
}
Pioche::Pioche(std::vector<Carte*> cartes, int nb_joueurs) {
Paquet();
for (auto c : cartes) {
if (c->getCouleur() == Couleur::violet)
for (size_t i = 0; i < nb_joueurs; i++)
ajouterCarte(c);//cartes violettes il y en a une par joueur
else if (c->getCouleur() != Couleur::monument)
for (size_t i = 0; i < 6; i++)
ajouterCarte(c);//autres cartes sauf les monuments il y en a 6 de chaque
}
}
//****************class Pioche*******************//
//****************Fonctions supplementaires******************//
std::ostream& operator<<(std::ostream& f, const Pioche& p)
{
f << "/**********Affichage Pioche**********/\n";
int i = 1;
std::vector<Carte*>cartes = p.getContener();
for (auto c : cartes)
{
f << "Carte n." << i;
f << *c << "\n";
i++;
}
f << "/**********Pioche Affiche**********/\n";
return f;
}
//****************Fonctions supplementaires******************//