Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
poo2019numeric
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
steven.liatti
poo2019numeric
Commits
35746501
Commit
35746501
authored
5 years ago
by
joel.cavat
Browse files
Options
Downloads
Patches
Plain Diff
Add Hangman for iteration 2
parent
60e55f59
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+38
-0
38 additions, 0 deletions
README.md
with
38 additions
and
0 deletions
README.md
+
38
−
0
View file @
35746501
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment