public void Setup()
        {
            Pattern1 = new HopfieldPattern(0.0, 1.0, 0.0, 1.0);
            Pattern2 = new HopfieldPattern(1.0, 0.0, 0.0, 1.0);

            Network = new HopfieldNetwork(4);

            Network.Train(Pattern1);
            Network.Train(Pattern2);
        }
        private void TrainButton_Click(object sender, RoutedEventArgs e)
        {
            var colCount = 5;
            var rowCount = 5;

            var pattern = new double[colCount * rowCount];

            for(var row=0; row<rowCount; row++)
            {
                for(var col=0; col<colCount; col++)
                {
                    pattern[row*colCount + col] = ((ToggleButton)_GetControlIn(DrawingGrid, new GridCoordinates(row, col))).IsChecked.Value
                        ? 1.0
                        : 0.0;
                }
            }

            var hopfieldPattern = new HopfieldPattern(pattern);
            hopfieldNetwork = hopfieldNetwork ?? new HopfieldNetwork(25);
            hopfieldNetwork.Train(hopfieldPattern);
        }