public void BackPropogate(NetworkState last, NetworkState now)
        {
            for (int i = states.Count - 1; i >= 0; i--)
            {
                object state = states[i];
                Layer  layer = Network.Layers[i];

                RecurrentLayer   recurrentLayer   = layer as RecurrentLayer;
                FeedForwardLayer feedForwardLayer = layer as FeedForwardLayer;

                if (recurrentLayer != null)
                {
                    RecurrentTrainingState recurrentState = (RecurrentTrainingState)state;
                    recurrentState.Last = (RecurrentState)last.states[i];
                    recurrentState.Now  = (RecurrentState)now.states[i];
                    recurrentLayer.BackPropogate(recurrentState);
                }
                else
                {
                    FeedForwardTrainingState feedForwardState = (FeedForwardTrainingState)state;
                    feedForwardState.Now = (FeedForwardState)now.states[i];
                    feedForwardLayer.BackPropogate(feedForwardState);
                }
            }
        }
        /// <summary>
        /// Creates a Recurrent Neural Network with the specified number of layers and one output Neuron.
        /// </summary>
        /// <param name="layerSize"></param>
        public RecurrentNetwork(NetworkConfiguration configuration, params int[] layerSize)
        {
            this.Configuration = configuration;
            configuration.InitialiseRandom();

            layers = new Layer[layerSize.Length];
            for (int i = 0; i < layers.Length - 1; i++)
            {
                //layers[i] = new FeedForwardLayer(layerSize[i + 1], layerSize[i]);
                layers[i] = new RecurrentLayer(configuration, layerSize[i + 1], layerSize[i]);
            }
            layers[layers.Length - 1] = new FeedForwardLayer(configuration, 1, layerSize[layerSize.Length - 1]);
        }