static void Main(string[] args) { var hangman = new Hangman(); var hangmanLives = hangman.lives; for (int i = 0; i <= hangmanLives; i++) { hangman.Draw(); hangman.RemoveOneLive(); } Console.WriteLine("Tak kopni do tý bedny, ať panstvo nečeká jsou dlouhý schody do nebe a štreka daleká."); Console.ReadKey(); }
void newGame() { game = new Hangman("Macedonia");//to be continued timeElapsed = 0; upDateTime(); timer1.Start(); timeLeft.Maximum = Hangman.TIME; timeLeft.Value = 10; unnsTries.Maximum = Hangman.TRIES; unnsTries.Value = game.WrongCount; MaskedWord.Text = game.init(); MessageBox.Show(game.init()); updateGuessedLetters(); }
static void Main(string[] args) { string _secret = "BigSecret"; var hman = new Hangman(_secret); var guessed = hman.GetGuessed(); Console.WriteLine("Here the hint: " + guessed); while (true) { Console.Write(String.Format("{0} tries left. Guess a char: ", hman.GetTries())); var ret = Console.ReadKey(); Console.WriteLine(""); guessed = hman.Guess(ret.KeyChar); Console.WriteLine("Here the guess: " + guessed); Console.WriteLine(""); var hang = hman.GetHangman(); Console.Write(hang); Console.WriteLine(""); if (hman.GetTries() == 0) { Console.WriteLine("You looooooose!!!!"); Console.WriteLine("The secret was: " + _secret); break; } else if (guessed.IndexOf('_') == -1) { Console.WriteLine("You won! Congratulations!!!!"); break; } } Console.Read(); }
private static void Main() { Hangman game = new Hangman(); Console.WriteLine("Welcome to Hangman"); Console.WriteLine("Use 'top' to view the top scoreboard," + "'restart' to start a new game, \n'help' to cheat and 'exit' to quit the game."); game.PrintWord(); Console.Write("enter a letter or command: "); string input = Console.ReadLine(); while (input != "exit") { if (input.Length == 1) { bool flag; flag = game.Guess(input[0]); if (flag == true) { game.End(); game.Restart(); } } else { switch (input) { case "top": { game.ShowScoreboard(); break; } case "help": { game.Help(); break; } case "restart": { game.Restart(); break; } default: { Console.WriteLine("invalid command"); break; } } } Console.WriteLine("Use 'top' to view the top scoreboard," + "'restart' to start a new game, \n'help' to cheat and 'exit' to quit the game."); game.PrintWord(); Console.Write("enter a letter or command: "); input = Console.ReadLine(); } Console.WriteLine("Goodbye"); }