diff --git a/README.md b/README.md index ab159e6c0f5bdb9986c1a7ec77ad8d70ed18e539..a8d8d0730cfc882e96bf3ff0729b700b25254b9c 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,11 @@ - Uniquement une abstraction + une implémentation avec liste ou tableau - L'abstraction doit avoir au moins deux méthodes par défaut (non statiques) - Corrigez le nom de la méthode `exist` en `exists` -- 13.11.2019: Le rendu est bien le 15 novembre +- 13.11.2019: Le rendu est bien le 17 novembre à 22h00 ## Délais -- 15 novembre à 22h00: Rendu de la version 1 de votre TP (`tag v1.0`) +- 17 novembre à 22h00: Rendu de la version 1 de votre TP (`tag v1.0`) - Ensemble des fonctionnalités sur les vecteurs (package `ch.hepia.numeric`) - Deux fonctionnalités du pendu (package `ch.hepia.hangman`) - L'ensemble des fonctionnalités sur le tas binaire (package `ch.hepia.strucure`) @@ -31,7 +31,7 @@ Après avoir choisi votre binôme, vous devrez **impérativement** : - Ajouter Joel Cavat (@joel.cavat), Jeremy Gobet (@jeremy.gobet) et Steven Liatti (@steven.liatti) en tant que *Reporter* de votre repository. - Lire attentivement l'énoncé. -# Itération 1 (tag `v1.0` - 22 novembre à 22h00) +# Itération 1 (tag `v1.0` - 17 novembre à 22h00) ## Fonctionnalités à réaliser sur les vecteurs @@ -273,6 +273,44 @@ qui sera une alternative de `Vector.linespace(0.0, 5.0, 20)`. ## Fonctionnalités à réaliser sur le pendu +Modifiez le jeux pour une utilisation suivante : + +```java +Hangman h = Hangman.withSecretWord("mystere"); +/* + * variante: Hangman h = Hangman.randomWord(); + * (choisit aléatoirement un mot dans une liste) + * doit être implémenté ! + */ + +String currentWord = h.currentWord(); // currentWord = "_______"; +h = h.tryWith('h'); +int attempts = h.attempts(); // attempts = 1 +int failedAttempts = h.failedAttempts(); // attempts = 1 +currentWord = h.currentWord(); // currentWord = "_______"; +h.printGallowIfError(); // affiche la potence uniquement si le dernier essai est mauvais + +h = h.tryWith('s'); +attempts = h.attempts(); // attempts = 2 +failedAttempts = h.failedAttempts(); // attempts = 1 +currentWord = h.currentWord(); // currentWord = "____e_e"; +h.printGallowIfError(); +h.printGallow(); // affiche la potence même si aucune erreur + +// Utilisation finale +while ( !h.isFinished() ) { + String letter = askLetter(); // demande une lettre à l'utilisateur + h = h.tryWith( letter ); + h.printCurrentWord(); + h.printGallowIfError(); +} +if( h.hasWon() ) { + System.out.println("Bravo"); +} else { + System.out.println("Failed"); +} +``` + ## Fonctionnalités à réaliser sur les structures