Example #1
0
 // Смена на 2 полиња
 private void swap(Pole p1, Pole p2)
 {
     int tmp = p1.X;
     p1.X = p2.X;
     p2.X = tmp;
     tmp = p1.Y;
     p1.Y = p2.Y;
     p2.Y = tmp;
 }
Example #2
0
        // Креирање на објекти(полиња)
        private void game()
        {
            this.MouseDown += MouseKlik;
            X = 0;
            Y = 24;
            List<int> list = new List<int>();
            int br = 0, j = 0, k = 0;
            clear();
            for (int i = 0; i < N; i++)
                list.Add(i);

            for (int i = 0; i < N; i++, br++, k++)
            {
                if (M == 4)
                {
                    if (br == 4)
                    {
                        X = 0;
                        Y = 100;
                        k = 0;
                        j++;
                    }
                    if (br == 8)
                    {
                        X = 0;
                        Y = 176;
                        k = 0;
                        j++;
                    }
                    if (br == 12)
                    {
                        X = 0;
                        Y = 252;
                        k = 0;
                        j++;
                    }
                }
                else
                {
                    if (br == 3)
                    {
                        X = 0;
                        Y = 100;
                        k = 0;
                        j++;
                    }
                    if (br == 6)
                    {
                        X = 0;
                        Y = 176;
                        k = 0;
                        j++;
                    }

                }
                StringBuilder s = new StringBuilder(@f2.str1);
                StringBuilder s1 = new StringBuilder(@f2.str2);
                int n = r.Next(list.Count);
                int m = list[n];
                mat[j, k] = m;
                list.RemoveAt(n);
                if (m > 9)
                {
                    s1[20] = (char)(m % 10 + 48);
                    s = s1;
                }
                else
                    s[19] = (char)(m + 48);
                if (M == 4)
                {
                    s[15] = '4';
                    s[17] = '4';
                }
                Image sl = Image.FromFile(s.ToString());
                Pole p = new Pole(m, X, Y, 83, 76, sl);
                pole.Add(p);
                X += 83;
            }
        }