-
-
Save anonymous/2ba4a39c59f0c740f229 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* bouttonUp.cpp | |
* | |
* Created on: Sep 28, 2012 | |
* Author: Neth | |
*/ | |
#include "buttonUp.h" | |
#include <ctime> | |
#include <cstdlib> | |
// DEBUG | |
#include <iostream> | |
ButtonUp::ButtonUp(string nameJoueur1, string nameJoueur2){ | |
this->plateau = deque<deque<Outils::Button> >(Config::nbPile, deque<Outils::Button>(Config::nbPile)); | |
this->joueur1 = Joueur(nameJoueur1); | |
this->joueur2 = Joueur(nameJoueur2); | |
ButtonUp::initManche(); | |
} | |
void ButtonUp::initManche(){ | |
deque<Outils::Button> stock; | |
srand(time(0)); | |
for(unsigned i=0; i<Config::nbPile/3; i++){ // fix it | |
stock.push_back(Outils::BLANC); | |
stock.push_back(Outils::NOIR); | |
stock.push_back(Outils::ROUGE); | |
} | |
try{ | |
while(stock.size() != 0){ | |
//récupérer le premier élément | |
// choisir un deque au hasard | |
// si le deque est vide, on ajoute l'élément | |
// sinon on choisi un autre deque au hasard | |
unsigned n = rand() % 10; | |
cout << "rand : " << n << endl; | |
if(this->plateau.at(n).size() == 0){ | |
cout << "j'add" << endl; | |
//this->plateau.at(n).push_front(stock.at(0)); | |
//stock.pop_front(); | |
} | |
} | |
}catch(...){ | |
cout << "error" << endl; | |
exit(1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment