75 lines
2.1 KiB
C++
75 lines
2.1 KiB
C++
#include "PiocheDeCartes.h"
|
|
#include <iostream>
|
|
#include "constantes.h"
|
|
#include <windows.h>
|
|
#include "../include/utils.h"
|
|
#include <vector>
|
|
#include <cstdlib>
|
|
#include <time.h>
|
|
using namespace std;
|
|
PiocheDeCartes::PiocheDeCartes()
|
|
{
|
|
Carte* uneCarte;
|
|
for (int index_couleur = 0; index_couleur < TAILLE_TAB_COULEUR; index_couleur++)
|
|
{
|
|
for (int nb_cartes = 0; nb_cartes < 5; nb_cartes++)
|
|
{
|
|
uneCarte = new Carte(TAB_COULEUR[index_couleur], T_PLUS1_COULEUR);
|
|
this->tas.push_back(uneCarte);
|
|
}
|
|
uneCarte = new Carte(TAB_COULEUR[index_couleur], T_PLUS2_COULEUR);
|
|
this->tas.push_back(uneCarte);
|
|
for (int nb_cartes = 0; nb_cartes < 2; nb_cartes++)
|
|
{
|
|
uneCarte = new Carte(TAB_COULEUR[index_couleur], T_MOINS1_COULEUR);
|
|
this->tas.push_back(uneCarte);
|
|
}
|
|
}
|
|
for (int nb_cartes = 0; nb_cartes < 5; nb_cartes++)
|
|
{
|
|
uneCarte = new Carte(C_MULTI, T_PLUS1_MULTI );
|
|
this->tas.push_back(uneCarte);
|
|
}
|
|
for (int nb_cartes = 0; nb_cartes < 2; nb_cartes++)
|
|
{
|
|
uneCarte = new Carte(C_MULTI, T_MOINS1_MULTI);
|
|
this->tas.push_back(uneCarte);
|
|
}
|
|
for (int nb_cartes = 0; nb_cartes < 3; nb_cartes++)
|
|
{
|
|
uneCarte = new Carte(C_MULTI, T_PLUS1_DERNIERE);
|
|
this->tas.push_back(uneCarte);
|
|
}
|
|
for (int nb_cartes = 0; nb_cartes < 2; nb_cartes++)
|
|
{
|
|
uneCarte = new Carte(C_MULTI, T_PLUS2_DERNIERE );
|
|
this->tas.push_back(uneCarte);
|
|
}
|
|
|
|
//ctor
|
|
}
|
|
|
|
Carte* PiocheDeCartes::piocher_carte()
|
|
{
|
|
int index_pioche = rand() % this->tas.size();
|
|
Carte* carte_piochee = this->tas[index_pioche];
|
|
//int indexSelectionne = this->0+ index_pioche;
|
|
this->tas.erase(tas.begin() + index_pioche);
|
|
return carte_piochee;
|
|
}
|
|
|
|
|
|
void PiocheDeCartes::afficherPaquet()
|
|
{
|
|
for (int c = 0; c < this->tas.size(); c++)
|
|
{
|
|
printf_en_couleur(this->tas[c]->representation_type_carte(this->tas[c]->getType()), this->tas[c]->getCouleur());
|
|
}
|
|
cout << this->tas.size();
|
|
}
|
|
|
|
PiocheDeCartes::~PiocheDeCartes()
|
|
{
|
|
//dtor
|
|
}
|