/// <summary>
        /// Calculates the number of thieves and people images that will appear in the round. The imageOrder
        /// list will be updated accordingly.
        /// </summary>
        private void FillImageList()
        {
            // Randomly determine whether thief or person images should appear
            // And make sure at least one of thief and person appears
            thiefAppearInRound = RamGenerator.GenerateARandomBool();
            if (thiefAppearInRound)
            {
                // personAppearInRound could be either true or false
                personAppearInRound = RamGenerator.GenerateARandomBool();
                // Add thief image type to the list of images that will appear
                imageOrder.Add(Images.THIEF);
            }
            else
            {
                // personAppearInRound should be true
                personAppearInRound = true;
            }

            if (personAppearInRound)
            {
                // Determine the number of people that will appear this round
                numberOfPeople = RamGenerator.GenerateARamInt(MIN_PEOPLE, MAX_PEOPLE);
                // Add one person image type to the list for each person that will appear this round
                for (int count = 0; count < numberOfPeople; count += 1)
                {
                    imageOrder.Add(Images.PERSON);
                }
            }

            // For all the remaining square game objects, they will be left blank
            while (imageOrder.Count < 9)
            {
                imageOrder.Add(Images.BLANK);
            }
        }
Пример #2
0
            public void WHEN_GenerateARandomBool_THEN_TrueAndFalseAppearEqually()
            {
                int trueCountTotal = 0;

                // Run the random boolean generator 1000 times
                for (int i = 0; i < 1000; i++)
                {
                    testBoolValue = RamGenerator.GenerateARandomBool();
                    if (testBoolValue)
                    {
                        trueCountTotal += 1;
                    }
                }

                Assert.IsTrue(trueCountTotal < 600, "GenerateARandomBool: Out of 1000 calls, number of times true appeared " + trueCountTotal);
            }
Пример #3
0
            public IEnumerator WHEN_ClickCatchTheThief_THEN_CatchTheThiefImageCheck()
            {
                Grid = GameObject.Find("SquareGridArea");
                yield return(null);

                // Boolean to determine if the thief appears in this round
                bool thiefAppearInRound;
                // Boolean to determine if the person appears in this round
                bool          personAppearInRound;
                List <Images> imageOrder = new List <Images>();
                int           numberOfPeople;

                // Randomly determine whether thief or person images should appear
                // And make sure at least one of thief and person appears
                thiefAppearInRound = RamGenerator.GenerateARandomBool();
                if (thiefAppearInRound)
                {
                    // personAppearInRound could be either true or false
                    personAppearInRound = RamGenerator.GenerateARandomBool();
                    // Add thief image type to the list of images that will appear
                    imageOrder.Add(Images.THIEF);
                }
                else
                {
                    // personAppearInRound should be true
                    personAppearInRound = true;
                }

                if (personAppearInRound)
                {
                    // Determine the number of people that will appear this round
                    numberOfPeople = RamGenerator.GenerateARamInt(1, 3);
                    // Add one person image type to the list for each person that will appear this round
                    for (int count = 0; count < numberOfPeople; count += 1)
                    {
                        imageOrder.Add(Images.PERSON);
                    }
                }

                // For all the remaining square game objects, they will be left blank
                while (imageOrder.Count < 9)
                {
                    imageOrder.Add(Images.BLANK);
                }

                Assert.IsTrue(imageOrder.Count == 9, " message: no Error TestFCS1");
            }