예제 #1
0
        public void Add(params string[] translations)
        {
            bool isComplete = true;

            for (int i = 0; i < Languages.Length && isComplete; i++)
            {
                if (translations[i] == "")
                {
                    isComplete = false;
                }
            }
            if (isComplete)
            {
                if (Array.Exists(translations, t => t.Contains(WordSeparator[0].ToString())))
                {
                    throw new InvalidDataException($"'{WordSeparator[0]}' is not an allowed character.");
                }
                else
                {
                    ListOfWords.Add(new Word(translations));
                }
            }
            else
            {
                throw new ArgumentException($"The word '{translations[0]}' was not added since it wasn't translated to all languages.");
            }
        }
예제 #2
0
    public void SetupFirstWord(CreatureRoot val)
    {
        _ObjectHealth = ListOfWords.GetRandomWords((int)val.Stats.WordDifficulty);
        _OriginalWord = _ObjectHealth;

        val.GetCreatureWordCheckInfo().TextElement.text = _ObjectHealth;
    }
예제 #3
0
    public MyDictionary(TextAsset textAsset, TextAsset nounFile, TextAsset verbFile, TextAsset adverbFile, TextAsset adjFile)
    {
        randomWords = new ListOfWords[26];
        Nouns       = new ListOfWords[26];
        Verbs       = new ListOfWords[26];
        Adjectives  = new ListOfWords[26];
        Adverbs     = new ListOfWords[26];

        for (int i = 0; i < 26; i++)
        {
            randomWords[i] = new ListOfWords();
            Nouns[i]       = new ListOfWords();
            Verbs[i]       = new ListOfWords();
            Adjectives[i]  = new ListOfWords();
            Adverbs[i]     = new ListOfWords();
        }

        ReadRandomFile(textAsset);

        Debug.Log("Generating words: Nouns");
        Nouns = ReadWordsFromFile(nounFile);

        Debug.Log("Generating words: Verbs");
        Verbs = ReadWordsFromFile(verbFile);

        Debug.Log("Generating words: Adverbs");
        Adverbs = ReadWordsFromFile(adverbFile);

        Debug.Log("Generating words: Adjectives");
        Adjectives = ReadWordsFromFile(adjFile);
    }
예제 #4
0
 public void CreateDictionary(List <MedicalService> BillItemList)
 {
     foreach (MedicalService BI in BillItemList)
     {
         ListOfWords.Add(BI.Name);
     }
 }
예제 #5
0
파일: MainMenu.cs 프로젝트: Deth12/AIP_3
 private void UpdateDataGrid()
 {
     SQLiteAccess.LoadDataTable();
     ListOfWords.DataSource = SQLiteAccess.ds.Tables[0];
     ListOfWords.ClearSelection();
     Statistics.DataSource = SQLiteAccess.ds.Tables[1];
     Statistics.ClearSelection();
 }
예제 #6
0
        public void List(int sortByTranslation, Action <string[]> showTranslations)
        {
            List <Word> SortedList = ListOfWords.OrderBy(w => w.Translations[sortByTranslation]).ToList();

            foreach (var word in SortedList)
            {
                showTranslations(word.Translations);
            }
        }
예제 #7
0
 public void NewLevel()
 {
     if (Level != 0)
     {
         Level++;
     }
     FieldWidth++;
     FieldHeight++;
     ListOfWords.Clear();
     ListOfFoundWords.Clear();
 }
/*	public EnemyWordChecker(Text textElement, string enemyHealth, DefaultBehaviour parent){//Adding methods to events and setting startvalues
 *
 *              TextElement = textElement;
 *              _ObjectHealth = enemyHealth;
 *              _OriginalWord = enemyHealth;
 *              _TheObject = parent;
 *
 *              _WordsToRemove = 0;
 *
 *              TextElement.text = _ObjectHealth;
 * //		_CleaveDmg = TalentBonusStats.CleaveDmg; TODO tobeused
 * //		_StopChecking = false;
 *
 *              TypingEvents.OnCompareStart += CompareStart;
 *      //	TypingEvents.OnCompareRestart += CompareRestart;
 *              TypingEvents.OnCompareEnd += CompareEnd;
 * //		players.Add (new KeyValuePair<GameObject, KeyValuePair<Color, string[]>>(theParent.gameObject, new  KeyValuePair<Color, string[]> (Color.yellow, new string[1]{ "muaaaooo" })));
 *
 *              //_SpawnedObject = Instantiate (ObjectsToSpawn [k].creature.gameObject, SpawnPoints [_SpawnSpot].transform.position, Quaternion.identity, SpawnPoints [_SpawnSpot].transform) as GameObject;
 *      //	theParent.setword(ListOfWords.GetRandomWords (Healths[0]));
 *      }*/

/*	public EnemyWordChecker(Text textElement, DefaultBehaviour parent){//Adding methods to events and setting startvalues
 *
 *              _TheObject = parent;
 *              TextElement = textElement;
 *
 * //		_ObjectHealth = ListOfWords.GetRandomWords (TheCreature.HealthWordsLength[HealthIndex]);
 *              _ObjectHealth = ListOfWords.GetRandomWords (5);
 *              _OriginalWord = _ObjectHealth;
 *
 *              TextElement.text = _ObjectHealth;
 *
 *              TypingEvents.OnCompareStart += CompareStart;
 *              TypingEvents.OnCompareEnd += CompareEnd;
 *      }*/



    public void Setup()
    {
        _Players            = new List <KeyValuePair <GameObject, KeyValuePair <Color, string[]> > >();
        PlayersTypedCorrect = new List <bool>();

        _ObjectHealth = ListOfWords.GetRandomWords(TheCreature.HealthWordsLength[HealthIndex]);
        _OriginalWord = _ObjectHealth;

        TextElement.text = _ObjectHealth;

        TypingEvents.OnCompareStart += CompareStart;
        TypingEvents.OnCompareEnd   += CompareEnd;
    }
예제 #9
0
        public void removeWord(int id, ListOfWords list)
        {
            XmlElement nodes = list == ListOfWords.Studied ? studiedWords : studyingWords;

            removeElement(id, nodes);
            if (list == ListOfWords.Studied)
            {
                maxIdStudied--;
            }
            else
            {
                maxIdStudying--;
            }
            doc.Save(path);
        }
예제 #10
0
    public ListOfWords[] ReadWordsFromFile(TextAsset textAsset)
    {
        try
        {
            string[] fileLine = textAsset.text.Split("\n"[0]);

            ListOfWords[] words = new ListOfWords[26];

            for (int i = 0; i < words.Length; i++)
            {
                words[i] = new ListOfWords();
            }

            for (int i = 0; i < fileLine.Length; i++)
            {
                string word        = fileLine[i];
                string firstLetter = word.ToCharArray()[0].ToString();
                int    check       = DeterminePlaceInAlphabet(firstLetter);

                if (check == -1)
                {
                    continue;
                }

                words[check].addWord(word);
            }

            int numberOfWords = 0;
            for (int i = 0; i < words.Length; i++)
            {
                numberOfWords += words[i].getNumberOfWords();
            }

            Debug.Log(numberOfWords + " words found");

            return(words);
        }
        catch
        {
            Debug.Log("Could not read text file: " + textAsset);
            return(new ListOfWords[26]);
        }
    }
    void CompareStart(KeyValuePair <GameObject, KeyValuePair <Color, string[]> > InputString)   //Compares _EnemyHealth with what the player typed(InputString)
    {
        if (IgnoreTyping == false)
        {
            if (!_Players.Contains(InputString))               //Adding New Players To The List
            {
                _Players.Add(InputString);
                PlayersTypedCorrect.Add(true);
            }

            for (int i = 0; i < _Players.Count; i++)              //Checking If The InputString/CurrentPlayer Is Corrent And Need Update
            {
                if (_Players [i].Key == InputString.Key)
                {
                    _WordLengths = _Players [i].Value.Value [0].Length;

                    if (_WordLengths > _ObjectHealth.Length)
                    {
                        _WordLengths = _ObjectHealth.Length;
                    }

                    for (int j = (_WordLengths - 1); j >= 0; j--)
                    {
                        if (_Players [i].Value.Value [0] [j] != _ObjectHealth [j])
                        {
                            PlayersTypedCorrect [i] = false;
                            break;
                        }
                        if (j == 0)
                        {
                            PlayersTypedCorrect [i] = true;
                            if (_WordLengths == _ObjectHealth.Length)
                            {
                                if (TheCreature.HealthWords > 0)
                                {
                                    TheCreature.HealthWords--;

                                    if (HealthIndex >= TheCreature.HealthWordsLength.Length - 1)
                                    {
                                        HealthIndex = -1;
                                    }


                                    _Players [i].Key.GetComponent <PlayerManager> ().GotTheKill(_OriginalWord.Length);               //Giving The Player That Wrote The Last Word The Score  //TODO Give Each Player Tagged Score?
                                    _Players [i].Key.GetComponent <PlayerManager> ().ResetWord();                                    //Giving The Player That Wrote The Last Word The Score  //TODO Give Each Player Tagged Score?

                                    _ObjectHealth = ListOfWords.GetRandomWords(TheCreature.HealthWordsLength [++HealthIndex]);
                                    _OriginalWord = _ObjectHealth;

                                    TextElement.text = "";                                    //Removing Text So That I Can Add It Again With New Colors
                                    PlayerColor      = (Color32)Color.black;
                                    ColorValue       = PlayerColor.r.ToString("X2") + PlayerColor.g.ToString("X2") + PlayerColor.b.ToString("X2") + PlayerColor.a.ToString("X2");

                                    for (int k = 0; k < _ObjectHealth.Length; k++)
                                    {
                                        TextElement.text += string.Format("<color=#" + ColorValue + ">{0}</color>", _ObjectHealth [k]);
                                    }

                                    return;
                                }
                                else
                                {
                                    _Players [i].Key.GetComponent <PlayerManager> ().ResetWord();                                    //Giving The Player That Wrote The Last Word The Score  //TODO Give Each Player Tagged Score?
                                    _Players [i].Key.GetComponent <PlayerManager> ().GotTheKill(_OriginalWord.Length);               //Giving The Player That Wrote The Last Word The Score  //TODO Give Each Player Tagged Score?

                                    TypingEvents.OnCompareStart -= CompareStart;
                                    TypingEvents.OnCompareEnd   -= CompareEnd;
                                    TheCreature.OnDestroyed();
                                }
                            }
                            break;
                        }
                    }
                    break;
                }
            }

            _WordLengths = 0;
            NullCheck    = 0;

            for (int i = 0; i < _Players.Count; i++)              //Iterating Through Once To Find The Two Players That Have Typed The Most. If Two Are The Same The The One That Tagged It Is The Leader
            {
                if (PlayersTypedCorrect [i] == true)
                {
                    if (_Players [i].Value.Value [0].Length > _WordLengths)
                    {
                        _2ndLongestPlayer = _LongestPlayer;
                        _LongestPlayer    = _Players [i];
                        NullCheck++;
                    }
                }
            }

            _WordsToRemove   = 0;
            TextElement.text = "";                                                                                                                       //Removing Text So That I Can Add It Again With New Colors

            if (NullCheck > 1)                                                                                                                           //Adding 2nd Place Player Color
            {
                _WordLengths = _2ndLongestPlayer.Value.Value [0].Length;                                                                                 //Length Of Player Word
                //	ColorValue = ((Color32)_2ndLongestPlayer.Value.Key).ToString ("X2"); //Does'nt Work  Only White Comes Out
                PlayerColor = (Color32)_2ndLongestPlayer.Value.Key;                                                                                      //Player Color
                ColorValue  = PlayerColor.r.ToString("X2") + PlayerColor.g.ToString("X2") + PlayerColor.b.ToString("X2") + PlayerColor.a.ToString("X2"); //Setting Color, Only Way I Got It To Work

                for (int i = 0; i < _WordLengths; i++)                                                                                                   //Iterates Through And Adds The Letter Again But With Different Color
                {
                    _WordsToRemove++;
                    TextElement.text += string.Format("<color=#" + ColorValue + ">{0}</color>", _ObjectHealth [i]);
                }
            }

            if (NullCheck > 0)              //Adding 1nd Place Player Color
            {
                _WordLengths = _LongestPlayer.Value.Value [0].Length;
                //	ColorValue = ((Color32)_LongestPlayer.Value.Key).ToString ("X2"); //Does'nt Work  Only White Comes Out
                PlayerColor = (Color32)_LongestPlayer.Value.Key;
                ColorValue  = PlayerColor.r.ToString("X2") + PlayerColor.g.ToString("X2") + PlayerColor.b.ToString("X2") + PlayerColor.a.ToString("X2");

                for (int i = _WordsToRemove; i < _WordLengths; i++)
                {
                    _WordsToRemove++;
                    TextElement.text += string.Format("<color=#" + ColorValue + ">{0}</color>", _ObjectHealth [i]);
                }
            }

            //	ColorValue = ((Color32)Color.black).ToString ("X2");//Adding The Rest That's Not Written  //Does'nt Work  Only White Comes Out
            PlayerColor = (Color32)Color.black;
            ColorValue  = PlayerColor.r.ToString("X2") + PlayerColor.g.ToString("X2") + PlayerColor.b.ToString("X2") + PlayerColor.a.ToString("X2");

            for (int i = _WordsToRemove; i < _ObjectHealth.Length; i++)
            {
                TextElement.text += string.Format("<color=#" + ColorValue + ">{0}</color>", _ObjectHealth [i]);
            }
        }
    }
예제 #12
0
 public bool Remove(int translation, string word)
 {
     return(ListOfWords.Remove(ListOfWords.Find(x => x.Translations[translation].Equals(word))));
 }
예제 #13
0
    public void CompareStart(KeyValuePair <GameObject, KeyValuePair <Color, string[]> > InputString, CreatureRoot val)   //Is Called When The Player Types Something
    {
        myVariables = val.GetCreatureWordCheckInfo();

        if (!myVariables._Players.Contains(InputString))           //Adding New Players To The List
        {
            myVariables._Players.Add(InputString);
            PlayersTypedCorrect.Add(true);
        }

        for (int i = 0; i < myVariables._Players.Count; i++)          //Checking If The InputString/CurrentPlayer Is Corrent And Need Update
        {
            if (myVariables._Players [i].Key == InputString.Key)
            {
                _WordLengths = myVariables._Players [i].Value.Value [0].Length;

                if (_WordLengths > _ObjectHealth.Length)
                {
                    _WordLengths = _ObjectHealth.Length;
                }

                for (int j = (_WordLengths - 1); j >= 0; j--)
                {
                    if (myVariables._Players [i].Value.Value [0] [j] != _ObjectHealth [j])
                    {
                        PlayersTypedCorrect [i] = false;
                        break;
                    }
                    if (j == 0)
                    {
                        PlayersTypedCorrect [i] = true;
                        if (_WordLengths == _ObjectHealth.Length)
                        {
                            if (val.Stats.Health > 0)
                            {
                                val.Stats.Health--;



                                myVariables._Players [i].Key.GetComponent <PlayerManager> ().GotTheKill(_OriginalWord.Length);           //Giving The Player That Wrote The Last Word The Score  //TODO Give Each Player Tagged Score?
                                myVariables._Players [i].Key.GetComponent <PlayerManager> ().ResetWord();                                //Giving The Player That Wrote The Last Word The Score  //TODO Give Each Player Tagged Score?

                                _ObjectHealth = ListOfWords.GetRandomWords((int)val.Stats.WordDifficulty);
                                _OriginalWord = _ObjectHealth;

                                myVariables.TextElement.text = "";                                //Removing Text So That I Can Add It Again With New Colors
                                ColorValue = FreeCharacterColor.r.ToString("X2") + FreeCharacterColor.g.ToString("X2") + FreeCharacterColor.b.ToString("X2") + FreeCharacterColor.a.ToString("X2");

                                for (int k = 0; k < _ObjectHealth.Length; k++)
                                {
                                    myVariables.TextElement.text += string.Format("<color=#" + ColorValue + ">{0}</color>", _ObjectHealth [k]);
                                }

                                return;
                            }
                            else
                            {
                                myVariables._Players [i].Key.GetComponent <PlayerManager> ().ResetWord();                                //Giving The Player That Wrote The Last Word The Score  //TODO Give Each Player Tagged Score?
                                myVariables._Players [i].Key.GetComponent <PlayerManager> ().GotTheKill(_OriginalWord.Length);           //Giving The Player That Wrote The Last Word The Score  //TODO Give Each Player Tagged Score?

                                //TheCreature.OnDestroyed ();TODO Destroy/SendDestroy Request
                            }
                        }
                        break;
                    }
                }
                break;
            }
        }

        _WordLengths = 0;
        NullCheck    = 0;

        for (int i = 0; i < myVariables._Players.Count; i++)          //Iterating Through Once To Find The Two Players That Have Typed The Most. If Two Are The Same The The One That Tagged It Is The Leader
        {
            if (PlayersTypedCorrect [i] == true)
            {
                if (myVariables._Players [i].Value.Value [0].Length > _WordLengths)
                {
                    _2ndLongestPlayer = _LongestPlayer;
                    _LongestPlayer    = myVariables._Players [i];
                    NullCheck++;
                }
            }
        }

        _WordsToRemove = 0;
        myVariables.TextElement.text = "";                                                                                                            //Removing Text So That I Can Add It Again With New Colors

        if (NullCheck > 1)                                                                                                                            //Adding 2nd Place Player Color
        {
            _WordLengths = _2ndLongestPlayer.Value.Value [0].Length;                                                                                  //Length Of Player Word
            PlayerColor  = (Color32)_2ndLongestPlayer.Value.Key;                                                                                      //Player Color
            ColorValue   = PlayerColor.r.ToString("X2") + PlayerColor.g.ToString("X2") + PlayerColor.b.ToString("X2") + PlayerColor.a.ToString("X2"); //Setting Color, Only Way I Got It To Work

            for (int i = 0; i < _WordLengths; i++)                                                                                                    //Iterates Through And Adds The Letter Again But With Different Color
            {
                _WordsToRemove++;
                myVariables.TextElement.text += string.Format("<color=#" + ColorValue + ">{0}</color>", _ObjectHealth [i]);
            }
        }

        if (NullCheck > 0)                  //Adding 1nd Place Player Color
        {
            _WordLengths = _LongestPlayer.Value.Value [0].Length;
            PlayerColor  = (Color32)_LongestPlayer.Value.Key;
            ColorValue   = PlayerColor.r.ToString("X2") + PlayerColor.g.ToString("X2") + PlayerColor.b.ToString("X2") + PlayerColor.a.ToString("X2");

            for (int i = _WordsToRemove; i < _WordLengths; i++)
            {
                _WordsToRemove++;
                myVariables.TextElement.text += string.Format("<color=#" + ColorValue + ">{0}</color>", _ObjectHealth [i]);
            }
        }

        ColorValue = FreeCharacterColor.r.ToString("X2") + FreeCharacterColor.g.ToString("X2") + FreeCharacterColor.b.ToString("X2") + FreeCharacterColor.a.ToString("X2");

        for (int i = _WordsToRemove; i < _ObjectHealth.Length; i++)
        {
            myVariables.TextElement.text += string.Format("<color=#" + ColorValue + ">{0}</color>", _ObjectHealth [i]);
        }
    }
예제 #14
0
 public void addWord(string engWord, string rusWord, ListOfWords list)
 {
     addXmlWord(list == ListOfWords.Studying ? studyingWords : studiedWords, engWord, rusWord);
 }
예제 #15
0
 public string getRusWord(int id, ListOfWords list)
 {
     return(list == ListOfWords.Studying ? getWord(id, 1, studyingWords) : getWord(id, 1, studiedWords));
 }
예제 #16
0
    static void Main()   // Create the entry-point method, which is the exact block of code that will be ran.
    {
        Console.Clear(); // Clear the console.
        while (true)     // Create a while true loop that will continue going continuously, until a break statement has been speciifed.
        {
            // Okay, let's start up by setting up the word.
            Random      Random = new Random(); ListOfWords AllWords = new ListOfWords();               // Make an instance of the Random class so we can create random numbers, then make an instance of the ListOfWords array.
            string      ExactWord      = AllWords.Words[Random.Next(AllWords.Words.Length)].ToUpper(); // Create a string that will be the ExactWord. This will be a random word chosen from the ListOfWords array.
            char[][]    WordToGuess    = new char[ExactWord.Length][];                                 // Create a jagged array which will contain the letters of ExactWord. This will be useful for when the user actually plays hangman.
            List <char> GuessedLetters = new List <char> {
                ' ', '-'
            };                                         // Create a new list which will hold all guessed letters. This will also hold blacklisted letters by default, which will not change into "-" if found in WordToGuess.
            int  Chances = 7; int Attempts = 0;        // Create an integer that will be used as the amount of chances, then create another integer that will account the number of attempts.
            bool GameEnded = false;                    // Create a boolean that will be used to determine whether the game has ended or not.
            for (int i = 0; i < ExactWord.Length; i++) // Create a for loop that will loop as many times as the length of ExactWord.
            {
                char Value = '-';                      // Define the Value string, which will be placed into WordToGuess[i][0].
                if (GuessedLetters.Contains(ExactWord[i]))
                {
                    Value = ExactWord[i];                            // Check if GuessedLetters contains ExactWord[i]. If it does, set Value to be the same as ExactWord[i].
                }
                WordToGuess[i] = new char[] { Value, ExactWord[i] }; // Append an array onto WordToGuess, containing Value as the first instance of the array, then ExactWord[i] converted into a string.
            }

            // Now, we can start the session of hangman!
            Console.WriteLine("Hello and welcome to hangman! You will be given a random possibly-every-day word and you will have to guess the letters for it! You will have 7 chances, and for each letter you get incorrect, you will lose a chance!"); // Announce to the player that they are playing hangmna.
            Console.WriteLine("Okay, let's start!");                                                                                                                                                                                                      // Announce that the game is about to start.
            Console.WriteLine($"Chances left: {Chances}");                                                                                                                                                                                                // Write the amount of chances left.
            foreach (char[] Char in WordToGuess)
            {
                Console.Write(Char[0]);                                                                // Go through each array in the WordToGuess jagged array, then write Char[0]'s string value onto the console.
            }
            while (!GameEnded)                                                                         // Make a while loop that will continue until GameEnded is True.
            {
                char KeyPressed = char.ToUpper(Console.ReadKey(true).KeyChar); bool KeyInWord = false; // Get the next key pressed converted to a string and then made upper-case, then create a new boolean used to determine whether the key is actually in the word or not.
                Attempts++;                                                                            // Increment Attempts.
                if (!GuessedLetters.Contains(KeyPressed))                                              // Check if GuessedLetters does not contain KeyPressed.
                {
                    foreach (char[] Char in WordToGuess)                                               // Go through all arrays in the WordToGuess jagged array.
                    {
                        if (Char[1] == KeyPressed)                                                     // Check if Char[1] is the same as the user input and the list does not already contain the user input.
                        {
                            Char[0]   = Char[1];                                                       // Change Char[0] to have the same value as Char[1]
                            KeyInWord = true;                                                          // Set KeyInWord to true.
                        }
                    }
                    Console.SetCursorPosition(0, 4); Console.Write("\r"); foreach (char[] Char2 in WordToGuess)
                    {
                        Console.Write(Char2[0]);
                    }
                    Console.Write($"\n{new string(' ', 100)}\r");                                   // Wipe out the current line, then go through each array in the WordToGuess jagged array and then write Char[0]'s string value onto the console.
                    GuessedLetters.Add(KeyPressed);                                                 // Add the KeyPressed value onto the GuessedLetters list.
                }
                if (!KeyInWord)                                                                     // Check if KeyInWord is false.
                {
                    Chances--;                                                                      // Decrement Chances.
                    Console.SetCursorPosition(0, 3); Console.WriteLine($"Chances left: {Chances}"); // Set the cursor position to the 3rd line, then overwrite the chances left statement.
                    foreach (char[] Char in WordToGuess)
                    {
                        Console.Write(Char[0]);                                  // Go through each array in the WordToGuess jagged array, then write Char[0]'s string value onto the console.
                    }
                }
                GameEnded = true; // Set GameEnded to true. This will be set to false in the next line if the criterias that will be mentioned do not meet.
                foreach (char[] Value in WordToGuess)
                {
                    if (Value[0] != Value[1])
                    {
                        GameEnded = false;                                                         // Go through all string arrays in WordToGuess, and check if the array's first value is not the same as the array's second value. If this is the case, set GameEnded to false.
                    }
                }
                if (Chances != 0 && !KeyInWord) // Check if the user still has at least one chance and KeyInWord is false.
                {
                    Console.WriteLine("\nWhoops! Seems like the key you have inputted has been mentioned already, or it is not in the word!");
                }
                else if (Chances == 0) // Check if Chances is 0.
                {
                    Console.WriteLine("\nOh dear, you ran out of chances. Make sure that you are keeping track of the word. Better luck next time!");
                    break;                  // End the loop.
                }
                else if (GameEnded == true) // Check if the game has ended.
                {
                    Console.WriteLine($"\nCongratulations, you completed the game!\nThe amount of attempts made were {Attempts} attempts.");
                }
            }
            Console.WriteLine("Would you like to play again? (Y/N)"); // Ask the user if he would like to try again.
            string PlayAgain = "NOT CHECKED";                         // Create a string value that will depict whether to play again or not.
            while (true)
            {
                ConsoleKeyInfo KeyBeingRead = Console.ReadKey(true); // Create a new variable that will depict the key being read.
                if (KeyBeingRead.Key == ConsoleKey.Y)
                {
                    Console.Clear(); PlayAgain = "true";
                }
                else if (KeyBeingRead.Key == ConsoleKey.N)
                {
                    PlayAgain = "false";                                                                                                                       // Check if the user pressed Y or N. Y - clear the console and set PlayAgain to "true", N - set PlayAgain to "false".
                }
                if (PlayAgain != "NOT CHECKED")
                {
                    break;                             // If PlayAgain is not "NOT CHECKED", end the loop.
                }
            }
            if (PlayAgain != "true")
            {
                break;                      // End the loop, which will end this process.
            }
        }
    }