示例#1
0
        public static void DrawDoubleGame()
        {
            Console.Clear();
            Console.WriteLine("╔══════════════════════════════════════════════════════════════════════════════╗");
            Console.WriteLine("║ " + string.Join("  ", Globals.alphabet) + " ║");
            Console.WriteLine("║ " + string.Join("  ", Globals.marker) + " ║");
            Console.WriteLine("║ " + Globals.image[Globals.triesLeft][0] + "                                                                   ║");
            Console.WriteLine("║ " + Globals.image[Globals.triesLeft][1] + "                                                                   ║");
            Console.WriteLine("║ " + Globals.image[Globals.triesLeft][2] + Line.calculateLine(67, Globals.phraseMarker) + "║");
            Console.WriteLine("║ " + Globals.image[Globals.triesLeft][3] + "                                                                   ║");
            Console.WriteLine("║ " + Globals.image[Globals.triesLeft][4] + "                                                                   ║");
            Console.WriteLine("╠═══════════════════════╦═════════════════╦═════════════════════════╦══════════╣");
            Console.WriteLine("║ Category: " + Line.calculateLine(12, Globals.category) + "║ Hints: " + Globals.hintsLeft + " [hint] ║     Rounds left: " + Globals.roundsLeft / 2 + "      ║  [menu]  ║");
            Console.WriteLine("╠════════════╦══════════╩═╦═══════════════╩═════════════════════╦═══╩══════════╣");
            Console.WriteLine("║  Player 1  ║ " + Line.calculateLine(10, Globals.namePlayer[0]) + " ║             Score: " + Line.calculateLine(4, Globals.scorePlayer[0].ToString()) + "            " + " ║ " + Line.calculateLine(12, Globals.nowGuessing[0]) + " ║");
            Console.WriteLine("╠════════════╬════════════╬═════════════════════════════════════╬══════════════╣");
            Console.WriteLine("║  Player 2  ║ " + Line.calculateLine(10, Globals.namePlayer[1]) + " ║             Score: " + Line.calculateLine(4, Globals.scorePlayer[1].ToString()) + "            " + " ║ " + Line.calculateLine(12, Globals.nowGuessing[1]) + " ║");
            Console.WriteLine("╚════════════╩════════════╩═════════════════════════════════════╩══════════════╝");

            Console.WriteLine("");
            if (!EndGame.DoubleEndGame())
            {
                Console.Write(" Input a letter: ");
            }
        }
示例#2
0
        public static string GetHint()
        {
            string stringOutput = "";

            if ((!EndGame.DoubleEndGame() || !EndGame.SingleEndGame()) && Globals.hintsLeft > 0)
            {
                char[] phrase = Globals.phrase.ToLower().ToCharArray();
                Array.Reverse(phrase);
                char[] alphabet = string.Join("", Globals.alphabet).ToLower().ToCharArray();
                bool   output   = true;

                for (int i = 0; i < phrase.Length; i++)
                {
                    for (int j = 0; j < alphabet.Length && output; j++)
                    {
                        if (phrase[i] == alphabet[j] && Globals.marker[j] != "¯")
                        {
                            stringOutput = Globals.alphabet[j];
                            output       = false;
                        }
                    }
                }
                Globals.hintsLeft--;
                return(stringOutput);
            }
            else
            {
                Console.WriteLine(" No hints left");
                return(stringOutput);
            };
        }
示例#3
0
        public static void gameOutcome(int live, string hang, string phrase, Action drawGame)
        {
            if (Globals.gameState == "single")
            {
                drawGame();
                Console.WriteLine("");
                Console.WriteLine(hang);
                if (phrase != "")
                {
                    Console.WriteLine(phrase);
                }
                if (EndGame.wonGame())
                {
                    Globals.score = Globals.score + Score.calcScore();
                }
                Lives.UpdateLives(live);
                Console.WriteLine(" Press any button to continue...");
                Console.Write(" ");
                Console.ReadKey();
                Library.GetPhrase();
                UpdateTable.restartTable();
                CheckLetter.checkLetter();
            }

            if (Globals.gameState == "double")
            {
                drawGame();
                Console.WriteLine("");
                Console.WriteLine(hang);
                if (phrase != "")
                {
                    Console.WriteLine(phrase);
                }
                Console.WriteLine(" Press any button to continue...");
                Console.ReadKey();
                if (Globals.roundsLeft > 1)
                {
                    Draw.doubleGameInput();
                    Library.SetCategory(Console.ReadLine());
                }
                if (EndGame.wonGame())
                {
                    Globals.scorePlayer[Globals.guessingPlayer] = Globals.scorePlayer[Globals.guessingPlayer] + Score.calcScore();
                }
                Lives.UpdateRounds(live);
                UpdateTable.restartTable();
                CheckLetter.checkLetter();
            }
        }
示例#4
0
 public static void SingleGameLoop()
 {
     while (!EndGame.SingleEndGame())
     {
         Draw.DrawSingleGame();
         UserInput.userInput();
         CheckLetter.checkLetter();
         if (EndGame.wonGame())
         {
             gameOutcome(0, " The man lives!", "", Draw.DrawSingleGame);
         }
         if (EndGame.lostGame())
         {
             gameOutcome(-1, " You let the man hang...", " The phrase was: " + Globals.phrase, Draw.DrawSingleGame);
         }
     }
 }
示例#5
0
 public static void DrawSingleGame()
 {
     Console.Clear();
     Console.WriteLine("╔══════════════════════════════════════════════════════════════════════════════╗");
     Console.WriteLine("║ " + string.Join("  ", Globals.alphabet) + " ║");
     Console.WriteLine("║ " + string.Join("  ", Globals.marker) + " ║");
     Console.WriteLine("║ " + Globals.image[Globals.triesLeft][0] + "                                                                   ║");
     Console.WriteLine("║ " + Globals.image[Globals.triesLeft][1] + "                                                                   ║");
     Console.WriteLine("║ " + Globals.image[Globals.triesLeft][2] + Line.calculateLine(67, Globals.phraseMarker) + "║");
     Console.WriteLine("║ " + Globals.image[Globals.triesLeft][3] + "                                                                   ║");
     Console.WriteLine("║ " + Globals.image[Globals.triesLeft][4] + "                                                                   ║");
     Console.WriteLine("╠═══════════════════════╦═════════════════╦══════════╦══════════════╦══════════╣");
     Console.Write("║ Category: " + Line.calculateLine(12, Globals.category) + "║");
     Console.WriteLine(" Hints: " + Globals.hintsLeft + " [hint] ║ Lives: " + Globals.livesLeft + " ║ Score:" + Line.calculateLine(7, Globals.score.ToString()) + "║  [menu]  ║");
     Console.WriteLine("╚═══════════════════════╩═════════════════╩══════════╩══════════════╩══════════╝");
     Console.WriteLine("");
     if (!EndGame.SingleEndGame())
     {
         Console.Write(" Input a letter: ");
     }
 }