예제 #1
0
        // Choses random wordGame object from list
        private void setWordRandom()
        {
            bool setWord = true;

            do
            {
                setWord = true;
                if (wordsList.Count == usedWords.Count) // If all words have been used, end game
                {
                    endGame = true;
                    break;
                }

                // Gets a random word from list
                wordGame wg = (wordGame)wordsList[Program.GetRandomNumber(0, wordsList.Count)];
                mainWord      = wg;
                lblHint1.Text = wg.getHint1();
                word          = wg.getWord();

                if (usedWords.Contains(wg.getWord()))
                {
                    setWord = false;
                }
            } while (setWord == false); // Will continue to loop if a word that has already been used is selected
        }
예제 #2
0
        // Adds wordGame objects to list
        private void addWordsToLIst()
        {
            wordGame DOG = new wordGame("DOG", "I have four legs", "I can do tricks", "I'm a man's best friend");

            wordsList.Add(DOG);

            wordGame TACO = new wordGame("TACO", "I'm latin food", "I'm popular in a northern latin country", "I'm wrapped in a tortilla");

            wordsList.Add(TACO);

            wordGame MONKEY = new wordGame("MONKEY", "I'm a furry mamal", "I live in trees", "I eat bananas");

            wordsList.Add(MONKEY);

            wordGame MOVIE = new wordGame("MOVIE", "People go to see me", "I'm on a screen", "I'm often showcased at theartes");

            wordsList.Add(MOVIE);

            wordGame RING = new wordGame("RING", "You wear me", "I am jewlery", "You put me on your finger");

            wordsList.Add(RING);

            wordGame HAMMER = new wordGame("HAMMER", "I am a tool", "I am used to hit things", "I am similar to a mallot");

            wordsList.Add(HAMMER);
        }