Skip to content

Instantly share code, notes, and snippets.

@tiltedlistener
Last active October 7, 2015 23:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tiltedlistener/8790d2d26570e9428135 to your computer and use it in GitHub Desktop.
Save tiltedlistener/8790d2d26570e9428135 to your computer and use it in GitHub Desktop.
NU: Hangman Partway
public class Hangman {
private String wordToGuess = "t";
private boolean gameRunning = true;
private int guessCount = 4;
public void playGame() {
while (gameRunning) {
// Fake player guess
String guess = "t";
if (wordToGuess.indexOf(guess) != -1) {
wordToGuess = wordToGuess.replace(guess, "");
if (wordToGuess.length() == 0) {
System.out.println("You Won");
break;
}
} else {
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment