public void guess(char guess, String name) { hangmanRules.makeGuess(guess); isComplete = hangmanRules.gameEnded(); writeMessage(getGameState(guess, name)); if (isComplete) { /* Start cleaning up */ stopGame(); } }
public void writeMessage(String msg) { Socket socket = null; TCPHandle handle = null; List<HangmanRules<Socket>.Player> players = hangmanRules.getPlayers(); for (HangmanRules<Socket>.Player player : players) { socket = player.playerData; handle = new TCPHandle(socket); handle.write(msg); } }
public String getGameState(char guess, String name) { String gameState = guess + " " + hangmanRules.getMaskedWord() + " " + hangmanRules.getTriesLeft() + " " + name; return gameState; }
public String getStatus() { return hangmanRules.getStatus(); }