Exemple #1
0
        public void logic(Random rnd)
        {
            Manager manager = new Manager(rnd);
            Row a = new Row();
            int count = 0;

            do
            {
                if (manager.possibilities.Count == 0)
                {
                    Console.WriteLine("mistake");
                    break;
                }
                a = manager.possibilities[rnd.Next(manager.possibilities.Count - 1)] as Row;
                a.pins(manager.answer, a);

                graphics(count, a,manager);
                //goes therw the hole array from up to down and ereases the not possiable options
                for (int i = manager.possibilities.Count - 1; i >= 0; i--)
                {
                    Row check = manager.possibilities[i] as Row;
                    int samePlace = HowManySamePlace(a, check);
                    int amount = HowManySameAll(a, check);
                    //the logic
                    if (a.black_pins != samePlace || amount > a.white_pins + a.black_pins)
                        manager.possibilities.RemoveAt(i);

                }
                count++;
            } while (a.black_pins < 4);

            //function that checks how many are at the same place
        }