예제 #1
0
        /// <summary>
        /// This method will be called once the window is initialising (after it has been added).
        /// Do not store a reference of the window unless you properly dispose it (remove reference once not required).
        /// </summary>
        /// <param name="window">The wpf window this panel will be added to.</param>
        protected override void OnInitialise(SigmaWindow window)
        {
            Content = new TicTacToeField(Handler, Monitor);

            _moveOrder = new List <int>(9);

            Block           = new Dictionary <string, INDArray>();
            PassNetworkHook = new PassNetworkHook(this, Block, TimeStep.Every(1, TimeScale.Epoch));
            PassNetworkHook.On(new ExternalCriteria(registerHoldFunc: action => InvokePass = action));

            UpdateBlock();

            Content.AiMove += AIMoveRequest;

            Trainer.AddGlobalHook(PassNetworkHook);

            //Content.FieldChange += FieldChange;
            IsReady = true;
        }
예제 #2
0
        public void SetInputReference(INDArray values)
        {
            Items.Clear();
            for (int i = 0; i < 10; i++)
            {
                Guess guess = new Guess();
                _guesses.Add(guess);
                Items.Add(guess);
            }
            Values = values;
            //TODO: check if hook already added, remove if...
            IDictionary <string, INDArray> block = new Dictionary <string, INDArray>();

            block.Add("inputs", Values);
            block.Add("targets", Handler.NDArray(1, 1, 10));
            if (Hook != null)
            {
                Trainer.Operator.DetachGlobalHook(Hook);
            }

            Hook = new PassNetworkHook(this, block, TimeStep.Every(1, TimeScale.Iteration));
            Trainer.AddGlobalHook(Hook);
        }