Hey guys I am working on a simple GUI word guess game in which one user inputs a word and another tries to guess it letter by letter. A user has 4 tries and each "-" represents a wrong guess before the "bomb" (shown as ----O) explodes. I have coded the GUI and the logic to show the stars for the word but I am stuck on the method to check the guess of user (checkGuess()). I appreciate your time
here is my code
public void checkGuess()
{
char[] wordToGuess = secretword.toCharArray();
guessLetter = guessBox.getText();
realGuessLetter = guessLetter.charAt(0);
for(int i=0; i<wordToGuess.length; i++)
{
if(realGuessLetter == wordToGuess[i])
{
wordSoFar[i] = realGuessLetter;
stardisplay = new String(wordSoFar);
}
}
}