class HangmanSession {
private HiddenKeyword hiddenKeyword;
private int triesNumber = 7;
public HangmanSession() {
hiddenKeyword = new HiddenKeyword();
}
private void printState() {
System.out.print( "Hidden word : " );
hiddenKeyword.print();
System.out.print( "Tries left: " + triesNumber + "\n<guess letter:>" );
}
public void play() {
boolean bool = true;
while( true ) {
bool = true;
printState();
System.out.println( "Try again, you've already used that letter " + char.class );
bool = false;
}
if( bool ) {
if( hiddenKeyword.guess( char.class ) ) {
System.out.println( "YAY! you have found letter! " + ch );
}
else {
triesNumber--;
}
if( triesNumber < 1 )
gameOver();
if( hiddenKeyword.found() )
congratulations();
}
} //end of bool
}
For the project I'm doing, I need to be able to guess letters. The fact that it is not letting me use "guess" is very problematic. What is the problem and how do I fix it?

New Topic/Question
Reply



MultiQuote



|