using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BibliothequeClasses { /// /// Représente une partie du jeu. /// public class Partie { private int tour; private Joueur joueur1; private Joueur joueur2; private Joueur joueurCourant; /// /// Initialise une nouvelle instance de la classe Partie avec les noms des joueurs. /// /// Le nom du premier joueur. /// Le nom du deuxième joueur. public Partie(string nomJoueur1, string nomJoueur2) { this.tour = 1; this.joueur1 = new Joueur(nomJoueur1); this.joueur2 = new Joueur(nomJoueur2); this.joueurCourant = this.joueur1; } /// /// Récupère le joueur qui joue actuellement. /// /// Le joueur actuel. public Joueur GetJoueur() { return this.joueurCourant; } /// /// Passe la main au prochain joueur. /// public void PasserlaMain() { if (this.joueurCourant == this.joueur1) { this.joueurCourant = this.joueur2; } else { this.joueurCourant = this.joueur1; } tour++; } /// /// Détermine si la partie est terminée. /// /// True si la partie est terminée, sinon False. public bool EstTerminer() { const int nbMaxTour = 24; if (joueurCourant.AGagne()) { return true; } if (tour == nbMaxTour) { return true; } return false; } } }