From 33c2b4ff03bba073989fb096035c00fe91407ba5 Mon Sep 17 00:00:00 2001 From: "pauline.prady" Date: Mon, 6 May 2024 18:31:45 +0200 Subject: [PATCH] Classe Partie --- Sources/ConsoleApp/Program.cs | 4 ++++ Sources/CoreLibrary/Code.cs | 2 -- Sources/CoreLibrary/Partie.cs | 25 ++++++++++++++++++++++--- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/Sources/ConsoleApp/Program.cs b/Sources/ConsoleApp/Program.cs index e69de29..3c85a5e 100644 --- a/Sources/ConsoleApp/Program.cs +++ b/Sources/ConsoleApp/Program.cs @@ -0,0 +1,4 @@ +using CoreLibrary; + +Partie maPartie = new Partie(new ReglesClassiques()); +maPartie.Jouer(); diff --git a/Sources/CoreLibrary/Code.cs b/Sources/CoreLibrary/Code.cs index c23f278..27bf7d4 100644 --- a/Sources/CoreLibrary/Code.cs +++ b/Sources/CoreLibrary/Code.cs @@ -37,8 +37,6 @@ public Jeton RecupererJeton(int indice) { - if(indice < 0 || indice > TailleMaximale()) - throw new CodeIndiceHorsDePorteeException(); Jeton? jeton = lesJetons[indice]; diff --git a/Sources/CoreLibrary/Partie.cs b/Sources/CoreLibrary/Partie.cs index ecb4b1c..fb61c2c 100644 --- a/Sources/CoreLibrary/Partie.cs +++ b/Sources/CoreLibrary/Partie.cs @@ -17,24 +17,43 @@ while (!regles.EstTerminee()) { - // ?? + Joueur joueurCourant = regles.JoueurCourant(); + Plateau plateauCourant = joueurCourant.Plateau; + + Code code = regles.GenererCode(); + + while (!code.EstComplet()) + { + AjouterJeton(code); + } + plateauCourant.AjouterCode(code); + + regles.PasserLaMain(); } PartieTerminee(); } + private void AjouterJeton(Code code) + { + Jeton jeton = new Jeton(Couleur.ROUGE); + code.AjouterJeton(jeton); + } + private void DefinirJoueurs() { while(regles.NbJoueurs != regles.NbJoueursMaximum) { - // + string nom = "pauline"; + regles.AjouterJoueur(nom); } } private void PartieTerminee() { - + regles.Gagnants(); + regles.Perdants(); }