public void WinnerBitmap(KohonenMap2D kohonen) { List <KohonenNeurone> neurones = new List <KohonenNeurone>(); foreach (KohonenNeurone neurone in kohonen.Grille) { if (neurone.NbGagnant > 0) { neurones.Add(neurone); } } neurones = neurones.OrderByDescending(n => n.NbGagnant).ToList(); List <KohonenNeurone> gagnants = new List <KohonenNeurone>(); foreach (KohonenNeurone neurone in neurones) { if (!gagnants.Any(w => w.Couleur == neurone.Couleur)) { gagnants.Add(neurone); if (gagnants.Count == 8) { break; } } } Graphics g = Position.CreateGraphics(); int factorX = (int)Position.Width / kohonen.X; int factorY = (int)Position.Height / kohonen.Y; Brush brush = Brushes.White; g.FillRectangle(brush, Position.ClientRectangle); foreach (var neurone in gagnants) { brush = new SolidBrush(neurone.Couleur); g.FillRectangle(brush, factorX * neurone.X, factorY * neurone.Y, factorX, factorY); } }
private void CreerReseau() { kohonen = new KohonenMap2D((int)Entrees.Value, (int)X.Value, (int)Y.Value, Pas, Couleurs()); // une carte aléatoire est toujours initialisée avec un nouveau réseau DisplayColor(Origine); }