コード例 #1
0
ファイル: Form1.cs プロジェクト: ATOM-Games/Neural_kohonen
        public void Klasterizovat()
        {
            int    Pobedx = -1, Pobedy = -1;
            double min = 99999999;

            for (int i = 0; i < Pixelki.Length; i++)
            {
                for (int j = 0; j < Pixelki[i].Length; j++)
                {
                    if (ABC_lob.DeltaColor(Color.FromArgb(255, 0, 0), Pixelki[i][j].BackColor) < min)
                    {
                        min    = ABC_lob.DeltaColor(Color.FromArgb(255, 0, 0), Pixelki[i][j].BackColor);
                        Pobedx = i;
                        Pobedy = j;
                    }
                }
            }
            if (Pobedx < 0 || Pobedy < 0)
            {
                MessageBox.Show("Победителя не оказалось");
            }
            else
            {
                Pobeditel pod = new Pobeditel(Pixelki[Pobedx][Pobedy]);
                pod.Show();
            }
            //--------------------------------------------
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: ATOM-Games/Neural_kohonen
        public void VideleniePobediteley()
        {
            for (int y = 0; y < 20; y++)
            {
                for (int x = 0; x < 20; Pixelki[y][x].Visible = false, x++)
                {
                    ;
                }
            }
            vis = false;
            //----------------------------------
            for (int po = 0; po < Oblo.Count(); po++)
            {
                int    Pobedx = -1, Pobedy = -1;
                double min = 99999999;
                for (int i = 0; i < Pixelki.Length; i++)
                {
                    for (int j = 0; j < Pixelki[i].Length; j++)
                    {
                        if (ABC_lob.DeltaColor(Oblo[po].Ideal, Pixelki[i][j].BackColor) < min)
                        {
                            min    = ABC_lob.DeltaColor(Oblo[po].Ideal, Pixelki[i][j].BackColor);
                            Pobedx = i;
                            Pobedy = j;
                        }
                    }
                }
                if (Pobedx < 0 || Pobedy < 0)
                {
                    MessageBox.Show("Победителя не оказалось");
                }
                else
                {
                    Pixelki[Pobedx][Pobedy].Visible = true;
                    Oblo[po].Centr = Pixelki[Pobedx][Pobedy].BackColor;
                    Oblo[po].X     = Pixelki[Pobedx][Pobedy].GetX();
                    Oblo[po].Y     = Pixelki[Pobedx][Pobedy].GetY();
                }
            }
            Iteracii ne = new Iteracii(this);

            ne.Show();
        }