GameGUI::GameGUI(Game *sdo, QWidget *parent) : QWidget(parent), ui(new Ui::GameGUI) { game = dynamic_cast<Game *>(sdo); setWindowTitle("Quoridor Game Grid"); game->attacher(this); lay= new QGridLayout(); initTable(); rafraichir(game); setLayout(lay); }
//------------------------------------------------------------------------------------------Demarrer void ControleurTexte::demarrer(void) { // char choix[32]; // int colonne; // int ligne; // bool ok; // // const Plateau & plateau = solitaire_.getPlateau(); // Arbitre & arbitre = solitaire_.getArbitre(); // // solitaire_.initialiser(); // // do { // std::cout << std::endl << "Action: "; // std::cin >> choix; // // colonne=999; // ok=false; // // if (choix[0]>='a' && choix[0]<='g') colonne=choix[0]-'a'; // else if (choix[0]>='A' && choix[0]<='G') colonne=choix[0]-'A'; // else if (choix[0]>='w' && choix[0]<='z') colonne=10+choix[0]-'w'; // else if (choix[0]>='W' && choix[0]<='Z') colonne=10+choix[0]-'W'; // else if (choix[0]=='o' || choix[0]=='0') colonne=100; // else if (choix[0]=='p' || choix[0]=='P') colonne=101; // // if (colonne<7) { // if (plateau.getMain().empty()) { // if (sscanf(choix+1,"%d",&ligne)!=1) ligne=plateau.getColonne(colonne).getTaille(); // std::cout << "Retrait colonne " << char('A'+colonne) << ligne << "... "; // ok=arbitre.retirerColonne(colonne,ligne-1); // } // else { // std::cout << "Depot colonne " << char('A'+colonne) << "... "; // ok=arbitre.deposerColonne(colonne); // } // } // else if (colonne<100) { // if (!plateau.getMain().empty()) { // colonne-=10; // std::cout << "Depot dock " << char('W'+colonne) << "... "; // ok=arbitre.deposerDock(colonne); // } // } // else if (colonne==100) { // if (plateau.getMain().empty()) { // std::cout << std::endl << "Piocher... "; // ok=arbitre.piocher(); // } // } // else if (colonne==101) { // if (plateau.getMain().empty()) { // std::cout << "Retrait pioche... "; // ok=arbitre.retirerPioche(); // } // } // else if (choix[0]=='u' || choix[0]=='U') { // std::cout << "Annuler... "; // ok=arbitre.annuler(); // } // // if (choix[0]!='q' && choix[0]!='Q') { // std::cout << (ok ? "OK" : "NON") << std::endl; // if (ok) rafraichir(); // } // } // while (choix[0]!='q' && choix[0]!='Q'); rafraichir(); }
PropositionObservateur::PropositionObservateur(Pendu *sdo, QWidget *parent): jeu{sdo},QLabel{parent} { jeu->attacher(this); rafraichir(jeu); }