private void LancerJeu(EntreeSortie pES) { Personnage Jojo = new Joueur("Heho", 150); Armes JetDe = new ArmeDe(7, 7); int CptMonstreFacile = 0; int CptMonstreDifficle = 0; while (Jojo.EstVivant) { Personnage monstre = GenererMonstre(); ReglesJeu.GererAttaque(Jojo, JetDe, monstre, JetDe); if (monstre.EstVivant) { ReglesJeu.GererAttaque(monstre, JetDe, Jojo, JetDe); } else { if (monstre.Niveau == ENiveau.Facile) { CptMonstreFacile++; } else { CptMonstreDifficle++; } } } pES.AfficherMessage("Partie terminee"); pES.AfficherMessage("Nb Monstres difficiles tues " + CptMonstreDifficle.ToString()); pES.AfficherMessage("Nb Monstres faciles tues " + CptMonstreFacile.ToString()); pES.AfficherMessage("Total points " + (CptMonstreFacile + CptMonstreDifficle * 2).ToString()); }
protected void TestFeuille(EntreeSortie pES) { //Feuille<int> feuille1 = new Feuille<int> { Valeur = 1 }; //Feuille<int> feuille2 = new Feuille<int> { Valeur = 3 }; Arbre <int> arbreTest = new Arbre <int>(); Random alea = new Random(); for (int i = 0; i < 50; i++) { arbreTest.Ajouter(alea.Next(100)); } //pES.AfficherMessage("feuille1= "+ feuille1.Valeur.ToString()+ "feuille2 = "+ feuille2.Valeur+ " : " +feuille1.Valeur.CompareTo(feuille2.Valeur).ToString()); //Feuille<int> feuille3 = new Feuille<int> { Valeur = 1 }; //pES.AfficherMessage(feuille1.Valeur.CompareTo(feuille3.Valeur).ToString()); //Feuille<int> feuille4 = new Feuille<int> { Valeur = -1 }; //pES.AfficherMessage(feuille1.Valeur.CompareTo(feuille4.Valeur).ToString()); }
public void TesterListe(EntreeSortie pES) { ListechaineDouble <int> ListeEntier = new ListechaineDouble <int>(); ListeEntier.Ajouter(5); ListeEntier.Ajouter(10); ListeEntier.Ajouter(4); AffichierListe(ListeEntier, pES); ListeEntier.Ajouter(99, 0); AffichierListe(ListeEntier, pES); ListeEntier.Ajouter(33, 2); AffichierListe(ListeEntier, pES); ListeEntier.Ajouter(30, 2); AffichierListe(ListeEntier, pES); AffichierListe(ListeEntier, pES, 1); ListeEntier.Supprimer(5); ListeEntier.Supprimer(4); AffichierListe(ListeEntier, pES); AffichierListe(ListeEntier, pES, 1); }
public void AffichierListe(ListechaineDouble <int> pListe, EntreeSortie pES, int pSens = 0) { if (pSens == 0) { Element <int> courant = pListe.Premier; while (courant != null) { pES.AfficherMessage(courant.Valeur.ToString()); courant = courant.Suivant; } } else { Element <int> courant = pListe.Dernier; while (courant != null) { pES.AfficherMessage(courant.Valeur.ToString()); courant = courant.Precedent; } } pES.AfficherMessage("--------------------"); }
private void LancerJeu2(EntreeSortie pES) { Personnage Jojo = new Joueur("Heho", 150); Personnage Baby = new MonstreBoss("Baby", 2500); Armes JetDe = new ArmeDe(25, 25); while (Jojo.EstVivant && Baby.EstVivant) { ReglesJeu.GererAttaqueBoss(Jojo, JetDe, Baby, JetDe); if (Baby.EstVivant) { ReglesJeu.GererAttaqueBoss(Baby, JetDe, Jojo, JetDe); } } if (Jojo.EstVivant) { pES.AfficherMessage("Jojo a gagne"); } else { pES.AfficherMessage("Le vilain a gagne"); } }
public void Tester(EntreeSortie pES) { pES.AfficherMessage("Jeu du hero qui affronte des monstres"); LancerJeu2(pES); }
public void Tester(EntreeSortie pES) { pES.AfficherMessage("Simulation d'un arbre"); TestFeuille(pES); pES.AfficherMessage("Fin"); }
public void Tester(EntreeSortie pES) { pES.AfficherMessage("TP liste chainee double"); TesterListe(pES); }