#pragma once #ifndef PUISSANCE4_HPP #define PUISSANCE4_HPP #include #include #include #include #include #include #include enum class Resultat { j1gagne, j0gagne, partieNulle }; template class Joueur { public: std::string nom; virtual unsigned Jouer(P p) = 0; virtual void FinPartie() { } std::string message; }; class P4 { private: static const int ROWS = 6; static const int COLS = 7; std::vector> board; bool GrillePleine() const; bool EstGagnant(int row, int col) const; public: bool j1aletrait; P4(); std::string ToString() const; void EffectuerCoup(unsigned col); unsigned Nbcoups(); Resultat Eval() const; }; class JHP4 : public Joueur { public: JHP4(); unsigned Jouer(P4 p) override; }; class IARandom : public Joueur { public: IARandom(); unsigned Jouer(P4 p) override; }; template struct noeud { noeud

* pere; noeud

** fils; unsigned nbfils; P p; unsigned cross, win; unsigned indiceMeilleurFils; static unsigned compt; explicit noeud(noeud

* pere, P p); ~noeud(); std::string ToString() const; void CalculMeilleurFils(double a); noeud

* MeilleurFils(); }; template class JMCTS : public Joueur

{ private: double a; unsigned temps; noeud

* racine; public: JMCTS(double a, unsigned temps); unsigned JeuHasard(P p) const; unsigned Jouer(P p) override; }; template class Partie { private: P pCourante; Joueur

& j1; Joueur

& j0; bool affichage; Resultat r; public: Partie(Joueur

& j1, Joueur

& j0, P pInitiale, bool aff = true); void Commencer(); }; #endif