static void Hangman() { string[] movies = { "INCEPTION", "GOODFELLAS", "PARASITE", "INTERSTELLAR", "HARAKIRI", "PSYCHO", "GLADIATOR", "WHIPLASH", "CASABLANCA", "ALIEN", "MEMENTO", "JOKER", "OLDBOY", "COCO", "BRAVEHEART", "AMADEUS", "VERTIGO", "M", "SNATCH", "SCARFACE", "IKIRU", "METROPOLIS", "UP", "HEAT", "YOJIMBO", "UNFORGIVEN", "CASINO", "CHINATOWN","STALKER", "FARGO", "PLATOON", "ROCKY" }; string[] hardWords = { "ABRUPTLY", "ABSURD", "ABYSS", "AWKWARD", "BEEKEEPER", "BIKINI", "COBWEB", "GOSSIP", "HAIKU", "JAZZ", "JIGSAW", "KIWIFRUIT", "JUKEBOX", "KEYHOLE", "MATRIX", "OXYGEN", "PAJAMAS", "VAPORWARE", "VODKA", "VOODOO", "WITCHCRAFT", "ZODIAC", "WIZARD", "ZOMBIE" }; string[] countries = { "LITHUANIA", "CYPRUS", "JAPAN", "GEORGIA", "BRAZIL", "TUNISIA", "FIJI", "CHINA", "ROMANIA", "PORTUGAL", "SINGAPORE", "SWEDEN", "FINLAND", "SPAIN", "GREENLAND", "ICELAND", "NETHERLANDS", "GERMANY", "BULGARIA", "CANADA", "FRANCE", "LUXEMBOURG","ESTONIA", "AUSTRALIA", "RUSSIA", "GREECE", "CHILE", "URUGUAY", "INDIA", "MALAYSIA", "THAILAND", "VIETNAM", "BHUTAN" }; bool playGame = true; while (playGame) { Soundtrack player = new Soundtrack(); player.MainGame(); List <char> lettersChosen = new List <char>(); List <string> wordsChosen = new List <string>(); var random = new Random(); var selection = ChooseCategory(); var word = WordSelection(selection, movies, hardWords, countries, random); char[] wordCharArray = GetEmptyWordArray(word.Length); bool guessesEnded = false; int mistakes = 0; while (!guessesEnded) { Console.Clear(); HangmanPictures(mistakes); Console.WriteLine(); PrintCharArray(wordCharArray); PrintLettersAndWordsGuessed(lettersChosen, wordsChosen); Console.Write("Guess letter or a whole word: "); var guess = Console.ReadLine().ToUpper(); while (!(IsGoodGuess(guess) && DoesItRepeat(guess, lettersChosen, wordsChosen))) { Console.WriteLine("Guess letter or a whole word"); guess = Console.ReadLine().ToUpper(); } GuessesChosen(guess, lettersChosen, wordsChosen); if (!GuessesAnalysis(guess, word, wordCharArray)) { mistakes++; } if (mistakes == 6) { Console.Clear(); HangmanPictures(mistakes); PrintCharArray(wordCharArray); PrintLettersAndWordsGuessed(lettersChosen, wordsChosen); Console.WriteLine(); Console.WriteLine($"The word was: {word}\n"); guessesEnded = true; } else if (DidThePlayerWon(wordCharArray)) { Console.Clear(); HangmanPictures(mistakes); PrintCharArray(wordCharArray); PrintLettersAndWordsGuessed(lettersChosen, wordsChosen); Soundtrack victorySound = new Soundtrack(); victorySound.Victory(); Console.WriteLine("You won!"); guessesEnded = true; } } playGame = RestartGame(); Console.Clear(); } }
static void HangmanPictures(int a) { switch (a) { case 0: Console.WriteLine(@" ___________.._______ "); Console.WriteLine(@"| .__________))______| "); Console.WriteLine(@"| | / / || "); Console.WriteLine(@"| | / / || "); Console.WriteLine(@"| |/ / || "); Console.WriteLine(@"| | / || "); Console.WriteLine(@"| |/ |/ "); Console.WriteLine(@"| | || "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"----------|_ |---| "); Console.WriteLine(@"----------\ \ | | "); Console.WriteLine(@"| | \ \ | | "); Console.WriteLine(@"| | \ \ | | "); Console.WriteLine(@"| | `' | | "); Console.WriteLine("\n\n "); break; case 1: Console.WriteLine(@" ___________.._______ "); Console.WriteLine(@"| .__________))______| "); Console.WriteLine(@"| | / / || "); Console.WriteLine(@"| | / / || "); Console.WriteLine(@"| |/ / || "); Console.WriteLine(@"| | / ||.-''. "); Console.WriteLine(@"| |/ |/ _ \ "); Console.WriteLine(@"| | || `/,| "); Console.WriteLine(@"| | (\\`_.' "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"----------|_ |---| "); Console.WriteLine(@"----------\ \ | | "); Console.WriteLine(@"| | \ \ | | "); Console.WriteLine(@"| | \ \ | | "); Console.WriteLine(@"| | `' | | "); Console.WriteLine("\n\n "); break; case 2: Console.WriteLine(@" ___________.._______ "); Console.WriteLine(@"| .__________))______| "); Console.WriteLine(@"| | / / || "); Console.WriteLine(@"| | / / || "); Console.WriteLine(@"| |/ / || "); Console.WriteLine(@"| | / ||.-''. "); Console.WriteLine(@"| |/ |/ _ \ "); Console.WriteLine(@"| | || `/,| "); Console.WriteLine(@"| | (\\`_.' "); Console.WriteLine(@"| | .-`--'. "); Console.WriteLine(@"| | Y. .Y\ "); Console.WriteLine(@"| | | | "); Console.WriteLine(@"| | | . | "); Console.WriteLine(@"| | | | "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"----------|_ |---| "); Console.WriteLine(@"----------\ \ | | "); Console.WriteLine(@"| | \ \ | | "); Console.WriteLine(@"| | \ \ | | "); Console.WriteLine(@"| | `' | | "); Console.WriteLine("\n\n "); break; case 3: Console.WriteLine(@" ___________.._______ "); Console.WriteLine(@"| .__________))______| "); Console.WriteLine(@"| | / / || "); Console.WriteLine(@"| | / / || "); Console.WriteLine(@"| |/ / || "); Console.WriteLine(@"| | / ||.-''. "); Console.WriteLine(@"| |/ |/ _ \ "); Console.WriteLine(@"| | || `/,| "); Console.WriteLine(@"| | (\\`_.' "); Console.WriteLine(@"| | .-`--'. "); Console.WriteLine(@"| | /Y. .Y\ "); Console.WriteLine(@"| | // | | "); Console.WriteLine(@"| | // | . | "); Console.WriteLine(@"| | ') | | "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"----------|_ |---| "); Console.WriteLine(@"----------\ \ | | "); Console.WriteLine(@"| | \ \ | | "); Console.WriteLine(@"| | \ \ | | "); Console.WriteLine(@"| | `' | | "); Console.WriteLine("\n\n "); break; case 4: Console.WriteLine(@" ___________.._______ "); Console.WriteLine(@"| .__________))______| "); Console.WriteLine(@"| | / / || "); Console.WriteLine(@"| | / / || "); Console.WriteLine(@"| |/ / || "); Console.WriteLine(@"| | / ||.-''. "); Console.WriteLine(@"| |/ |/ _ \ "); Console.WriteLine(@"| | || `/,| "); Console.WriteLine(@"| | (\\`_.' "); Console.WriteLine(@"| | .-`--'. "); Console.WriteLine(@"| | /Y. .Y\ "); Console.WriteLine(@"| | // | | \\ "); Console.WriteLine(@"| | // | . | \\ "); Console.WriteLine(@"| | ') | | (` "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"| | "); Console.WriteLine(@"----------|_ |---| "); Console.WriteLine(@"----------\ \ | | "); Console.WriteLine(@"| | \ \ | | "); Console.WriteLine(@"| | \ \ | | "); Console.WriteLine(@"| | `' | | "); Console.WriteLine("\n\n "); break; case 5: Console.WriteLine(@" ___________.._______ "); Console.WriteLine(@"| .__________))______| "); Console.WriteLine(@"| | / / || "); Console.WriteLine(@"| | / / || "); Console.WriteLine(@"| |/ / || "); Console.WriteLine(@"| | / ||.-''. "); Console.WriteLine(@"| |/ |/ _ \ "); Console.WriteLine(@"| | || `/,| "); Console.WriteLine(@"| | (\\`_.' "); Console.WriteLine(@"| | .-`--'. "); Console.WriteLine(@"| | /Y. .Y\ "); Console.WriteLine(@"| | // | | \\ "); Console.WriteLine(@"| | // | . | \\ "); Console.WriteLine(@"| | ') | | (` "); Console.WriteLine(@"| | ||' "); Console.WriteLine(@"| | || "); Console.WriteLine(@"| | || "); Console.WriteLine(@"| | || "); Console.WriteLine(@"| | / | "); Console.WriteLine(@"----------|_`-' |---| "); Console.WriteLine(@"----------\ \ | | "); Console.WriteLine(@"| | \ \ | | "); Console.WriteLine(@"| | \ \ | | "); Console.WriteLine(@"| | `' | | "); Console.WriteLine("\n\n "); break; case 6: Console.WriteLine(@" ___________.._______ "); Console.WriteLine(@"| .__________))______| "); Console.WriteLine(@"| | / / || "); Console.WriteLine(@"| | / / || "); Console.WriteLine(@"| |/ / || "); Console.WriteLine(@"| | / ||.-''. "); Console.WriteLine(@"| |/ |/ _ \ "); Console.WriteLine(@"| | || `/,| "); Console.WriteLine(@"| | (\\`_.' "); Console.WriteLine(@"| | .-`--'. "); Console.WriteLine(@"| | /Y. .Y\ "); Console.WriteLine(@"| | // | | \\ "); Console.WriteLine(@"| | // | . | \\ "); Console.WriteLine(@"| | ') | | (` "); Console.WriteLine(@"| | ||'|| "); Console.WriteLine(@"| | || || "); Console.WriteLine(@"| | || || "); Console.WriteLine(@"| | || || "); Console.WriteLine(@"| | / | | \ "); Console.WriteLine(@"----------|_`-' `-' |---| "); Console.WriteLine(@"----------\ \ | | "); Console.WriteLine(@"| | \ \ | | "); Console.WriteLine(@"| | \ \ | | "); Console.WriteLine(@"| | `' | | "); Console.WriteLine("\n\n "); Soundtrack GameOverSound = new Soundtrack(); GameOverSound.Death(); break; } }