forked from MetroCS/ConsoleGameHub
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWordGuessGame.java
More file actions
36 lines (33 loc) · 1.04 KB
/
WordGuessGame.java
File metadata and controls
36 lines (33 loc) · 1.04 KB
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
28
29
30
31
32
33
34
35
36
import java.util.Optional;
/**
* A word guessing game similar to Wordle.
* The player has a limited number of attempts to guess a secret
* 5-letter word.
* After each guess, the game indicates whether the guess is correct.
* <br />
* The score is determined by how many attempts the player had remaining
* when they guessed the word correctly.
* @version 1
*/
class WordGuessGame implements Game {
@Override
public String getName() {
return "Word Guess";
}
@Override
public Optional<Integer> play() {
System.out.println(
"[Playing Word Guess - You will have a limited number of attempts"
+ " to guess a secret 5 letter word.]"
);
System.out.println(
"After each guess, the game will indicate whether the guess is"
+ " correct."
);
System.out.println(
"Your score is determined by the number of attempts remaining"
+ " after you guessed the word correctly!"
);
return Optional.empty();
}
}