// Update map private void UpdateMap(DistanceNetwork network) { // get first layer Layer layer = network.Layers[0]; // lock Monitor.Enter(this); // run through all neurons for (int i = 0; i < layer.Neurons.Length; i++) { Neuron neuron = layer.Neurons[i]; int x = i % networkSize; int y = i / networkSize; map[y, x, 0] = (int)neuron.Weights[0]; map[y, x, 1] = (int)neuron.Weights[1]; map[y, x, 2] = 0; } // collect active neurons for (int i = 0; i < pointsCount; i++) { network.Compute(trainingSet[i]); int w = network.GetWinner(); map[w / networkSize, w % networkSize, 2] = 1; } // unlock Monitor.Exit(this); // mapPanel.Invalidate(); }