Esempio n. 1
0
        /// <summary>
        /// Takes a state of the board and returns probability of
        /// first player win.
        /// </summary>
        /// <param name="vector"></param>
        /// <returns></returns>
        public double EvaluateState(Board board)
        {
            //IMLData input = ANNAdapter.Adapt(board);
            IMLData input  = ANNAdapter.Adapt192(board);
            IMLData output = network.Compute(input);

            return(output[0]);
        }
Esempio n. 2
0
        /// <summary>
        /// Trains state inside neural network to generate new value function.
        /// </summary>
        /// <param name="currentState"></param>
        /// <param name="v"></param>
        public void Train(Board board, double v)
        {
            BasicMLDataSet trainingSet = new BasicMLDataSet();
            BasicMLData    ideal       = new BasicMLData(1);

            ideal[0] = v;
            //trainingSet.Add(ANNAdapter.Adapt(board), ideal);
            trainingSet.Add(ANNAdapter.Adapt192(board), ideal);
            IMLTrain train = new ResilientPropagation(network, trainingSet);

            train.Iteration();
        }