private static void GameLoop(WordScrambleGameClient proxy, String playerName, Word gameWords) { InformUser("Can you unscramble this word? => " + gameWords.ScrambledWord, wait: false); bool gameOver = false; while (!gameOver) { gameWords.UnscrambledWord = Console.ReadLine(); try { gameOver = proxy.GuessWord(playerName, gameWords); } catch (FaultException<WordMismatchFault> fault) { InformUser(fault.Detail.Message); // Inform user but let them try to keep playing } catch (FaultException<PlayerNotPlayingTheGameFault> fault) { try { gameWords = proxy.Join(playerName); // Try joining and trying again gameOver = proxy.GuessWord(playerName, gameWords); } catch (Exception exception) { // If anything else bad happends, we can return the first fault, the second exception and error out to console. InformUser(fault.Message); InformUser(exception.GetBaseException().Message); throw fault; } } if (!gameOver) { InformUser("Nope, try again...", wait: false); } } InformUser("You WON!!!"); }