I create a hangman game in java. I have no clue how to check and replace it. Everything works, the String word is correct and the gameboard is fine. So the game board give me the length of word as "_ _ _ _ _", for example.
public void spielStart(int topic) {
String[] wordList = this.wordList.chooseThemaArray(thema);
String word = this.wordList.pickRandom(wordList);
String gameboard = spielbrettvorbereiten(word);
Scanner userInput = new Scanner(System.in);
for (int i = 0; i <= fehlversuche;) {
System.out.println(gameboard);
System.out.print("Write a letter ");
String input = userInput.next();
int length = input.length();
boolean isTrue = letters.errateWortEingabe(length);
if (isTrue == true) {
if (word.contains(input)) {
}
} else {
i = i - 1;
}
i++;
}
I hope you guys can help me I am struggeling so hard.
Best Regards MichaelDev
Aucun commentaire:
Enregistrer un commentaire