Exemplo n.º 1
0
        static public Boolean set_finder(List <CARD> table)
        {
            Boolean solution = false;

            for (int i = 0; i < table.Count - 2; i++)
            {
                for (int j = i + 1; j < table.Count - 1; j++)
                {
                    for (int k = j + 1; k < table.Count; k++)
                    {
                        set s = new set()
                        {
                            a = (card)table[i].Tag, b = (card)table[j].Tag, c = (card)table[k].Tag
                        };

                        if (isSet(s))
                        {
                            solution = true;
                            goto k;
                        }
                    }
                }
            }
            k :  return(solution);
        }
Exemplo n.º 2
0
        public static set ArrayToSet(List <CARD> c)
        {
            set s = new set();

            s.a = (card)c[0].Tag;
            s.b = (card)c[1].Tag;
            s.c = (card)c[2].Tag;
            return(s);
        }
Exemplo n.º 3
0
        static public bool isSet(set s)
        {
            bool q2 = s.a.number != s.b.number && s.b.number != s.c.number && s.a.number != s.c.number;
            bool q1 = s.a.number == s.b.number && s.b.number == s.c.number && s.a.number == s.c.number;
            bool q  = q1 || q2;
            bool w2 = s.a.color != s.b.color && s.b.color != s.c.color && s.a.color != s.c.color;
            bool w1 = s.a.color == s.b.color && s.b.color == s.c.color && s.a.color == s.c.color;
            bool w  = w1 || w2;
            bool e2 = s.a.shape != s.b.shape && s.b.shape != s.c.shape && s.a.shape != s.c.shape;
            bool e1 = s.a.shape == s.b.shape && s.b.shape == s.c.shape && s.a.shape == s.c.shape;
            bool e  = e1 || e2;
            bool r2 = s.a.texture != s.b.texture && s.b.texture != s.c.texture && s.a.texture != s.c.texture;
            bool r1 = s.a.texture == s.b.texture && s.b.texture == s.c.texture && s.a.texture == s.c.texture;
            bool r  = r1 || r2;

            return(q && w && e && r);
        }
Exemplo n.º 4
0
        public static Boolean set_finder(List<CARD> table)
        {
            Boolean solution = false;
            for (int i = 0; i < table.Count - 2; i++)
                for (int j = i + 1; j < table.Count - 1; j++)
                    for (int k = j + 1; k < table.Count; k++)
                    {
                        set s = new set() { a = (card)table[i].Tag, b = (card)table[j].Tag, c = (card)table[k].Tag };

                        if (isSet(s))
                        {
                            solution = true;
                            goto k;
                        }

                    }
            k:  return solution;
        }
Exemplo n.º 5
0
 public static bool isSet(set s)
 {
     bool q2 = s.a.number != s.b.number && s.b.number != s.c.number && s.a.number != s.c.number;
     bool q1 = s.a.number == s.b.number && s.b.number == s.c.number && s.a.number == s.c.number;
     bool q = q1 || q2;
     bool w2 = s.a.color != s.b.color && s.b.color != s.c.color && s.a.color != s.c.color;
     bool w1 = s.a.color == s.b.color && s.b.color == s.c.color && s.a.color == s.c.color;
     bool w = w1 || w2;
     bool e2 = s.a.shape != s.b.shape && s.b.shape != s.c.shape && s.a.shape != s.c.shape;
     bool e1 = s.a.shape == s.b.shape && s.b.shape == s.c.shape && s.a.shape == s.c.shape;
     bool e = e1 || e2;
     bool r2 = s.a.texture != s.b.texture && s.b.texture != s.c.texture && s.a.texture != s.c.texture;
     bool r1 = s.a.texture == s.b.texture && s.b.texture == s.c.texture && s.a.texture == s.c.texture;
     bool r = r1 || r2;
     return q && w && e && r;
 }
Exemplo n.º 6
0
 public static set ArrayToSet(List<CARD> c)
 {
     set s = new set();
     s.a =(card) c[0].Tag;
     s.b = (card)c[1].Tag;
     s.c = (card)c[2].Tag;
     return s;
 }