forked from Unified-Logic-Development-Team/ConsoleGameHub
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHangmanGame.java
More file actions
27 lines (25 loc) · 757 Bytes
/
HangmanGame.java
File metadata and controls
27 lines (25 loc) · 757 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import java.util.Optional;
/**
* A traditional Hangman game.
* The player attempts to guess a secret word by guessing letters
* one at a time.
* Each incorrect guess reduces the number of remaining tries.
* <pre>
* Implements visual feedback (e.g., ASCII scaffold).
* Handles duplicate guesses and win/loss conditions.
* </pre>
* @version 1
*/
class HangmanGame implements Game {
@Override
public String getName() {
return "Hangman";
}
@Override
public Optional<Integer> play() {
System.out.println("Welcome to Hangman!");
System.out.println("Guess the hidden word one letter at a time.");
System.out.println("Each wrong guess reduces your number of tries.");
return Optional.empty();
}
}