-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPioche.cpp
More file actions
54 lines (44 loc) · 1.04 KB
/
Pioche.cpp
File metadata and controls
54 lines (44 loc) · 1.04 KB
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
//
// Created by lucas on 09/04/2023.
//
#include "Pioche.h"
#include "Carte.h"
#include "Schotten_Totten.h"
#include <iostream>
#include <algorithm>
#include <random>
using namespace std;
Pioche::Pioche(vector<Carte_clan*>& cartes) {
for (size_t i = 0; i < cartes.size(); i++) {
cartes_pioche.push_back(cartes[i]);
}
melange();
}
Pioche::Pioche(vector<Carte_tactique*>& cartes) {
for (size_t i = 0; i < cartes.size(); i++) {
cartes_pioche.push_back(cartes[i]);
}
melange();
}
void Pioche::melange() {
random_device rd;
mt19937 g(rd());
// Melange du vecteur avec le seed
shuffle(cartes_pioche.begin(), cartes_pioche.end(), g);
}
Pioche::Pioche(int n) {
cout << "essai";
}
bool Pioche::est_vide() {
return cartes_pioche.size() == 0;
}
Carte& Pioche::piocher_carte() {
if (est_vide()) {
cout << "pas possible de piocher" << endl;
}
Carte& c = *cartes_pioche.back();
cartes_pioche.pop_back();
cout << "return c" << endl;
//cout << c << endl;
return c;
}