From 357465011d5717ed838e3b128ec1452fbd8da815 Mon Sep 17 00:00:00 2001
From: "joel.cavat" <joel.cavat@hesge.ch>
Date: Wed, 13 Nov 2019 19:30:31 +0100
Subject: [PATCH] Add Hangman for iteration 2

---
 README.md | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/README.md b/README.md
index c039cf0..8099af9 100644
--- a/README.md
+++ b/README.md
@@ -275,6 +275,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 = HangmanGame.withSecretWord("mystere");
+/*
+ * variante: Hangman h = HangmanGame.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.failedAttepts(); // attempts = 1
+currentWord = h.currentWord(); // currentWord = "_______";
+h.printGallowsIfError(); // affiche la potence uniquement si le dernier essai est mauvais
+
+h = h.tryWith('s');
+attempts = h.attempts(); // attempts = 2
+failedAttempts = h.failedAttepts(); // attempts = 1
+currentWord = h.currentWord(); // currentWord = "____e_e";
+h.printGallowsIfError();
+h.printGallows(); // 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
 
 
-- 
GitLab