Esempio n. 1
0
        public void RandomizeAnswerLocation(List <Type> list)
        {
            int  k    = rnd.Next(0, 6);
            Type temp = list[k];

            list[k] = list[5];
            list[5] = temp;
        }
Esempio n. 2
0
        public void Guess(Type type)
        {
            Console.WriteLine($"The type is {type.TypeName}");

            List <Type> isContained = CurrentlySelected.Where(x => x.TypeName.CompareTo(type.TypeName) == 0).ToList();

            if (isContained.Count() > 0)
            {
                CurrentlySelected.Remove(isContained[0]);
            }
            else
            {
                CurrentlySelected.Add(type);
            }

            Console.WriteLine("Currently Selected types:");
            foreach (var selection in CurrentlySelected)
            {
                Console.WriteLine($"    {selection.TypeName}");
            }
        }
Esempio n. 3
0
        public void GenerateRandomTypes(string type = null)
        {
            CurrentlySelected = new List <Type>();
            if (type == null)
            {
                while (type == "Normal" || type == null)
                {
                    int choice = rnd.Next(0, 18);

                    switch (choice)
                    {
                    case 0:
                        type = "Bug";
                        break;

                    case 1:
                        type = "Dark";
                        break;

                    case 2:
                        type = "Dragon";
                        break;

                    case 3:
                        type = "Electric";
                        break;

                    case 4:
                        type = "Fairy";
                        break;

                    case 5:
                        type = "Fighting";
                        break;

                    case 6:
                        type = "Fire";
                        break;

                    case 7:
                        type = "Flying";
                        break;

                    case 8:
                        type = "Ghost";
                        break;

                    case 9:
                        type = "Grass";
                        break;

                    case 10:
                        type = "Ground";
                        break;

                    case 11:
                        type = "Ice";
                        break;

                    case 12:
                        type = "Normal";
                        break;

                    case 13:
                        type = "Poison";
                        break;

                    case 14:
                        type = "Psychic";
                        break;

                    case 15:
                        type = "Rock";
                        break;

                    case 16:
                        type = "Steel";
                        break;

                    case 17:
                        type = "Water";
                        break;
                    }
                }
            }

            CurrentType = type;

            List <Type> tempTypes = TypeService.GetTypes();

            List <int> selectedSet = new List <int>();

            for (int i = 0; i < 5; i++)
            {
                int choice = rnd.Next(0, 18);
                while (selectedSet.Contains(choice))
                {
                    choice = rnd.Next(0, 18);
                }
                selectedSet.Add(choice);
            }



            List <Type> types = new List <Type>();

            foreach (int num in selectedSet)
            {
                types.Add(tempTypes[num]);
            }

            CurrentObjType = TypeService.GetTypeByName(type);

            Type temp2 = null;

            if (CurrentObjType.SuperEffective.Count > 0)
            {
                int k = rnd.Next(0, CurrentObjType.SuperEffective.Count);
                temp2 = TypeService.GetTypeByName(CurrentObjType.SuperEffective[k]);
            }
            else
            {
                temp2 = new Type {
                };
            }

            types.Add(temp2);

            Types = types;

            RandomizeAnswerLocation(Types);

            TypesSuperEffectiveAgainst = TypeService.GetSuperEffectiveAgainst(type);
        }