Esempio n. 1
0
        Action ChooseRandStep(Direction dir)
        {
            Action step = null;
            Random rnd = new Random();
            do
            { //перебор направлений движения не закончится, пока мы знаем, что предполагаемое направление наверно.
                step = actArr[rnd.Next(0, actArr.Count())];
            } while (Machine.IsOutputWrongForInput(dir.symbol, step.symbol));

            return step;
        }
Esempio n. 2
0
        void LearnToMove(Direction dir)
        {
            Action step;

            do
            {
                step = ChooseRandStep(dir);
                rob.MakeStep(step, learnDelay);

                Interface.LrnStepAdd(); //плюс шаг, потраченный на обучение

                if (IsLastStepRight(dir.axis))
                    Machine.SetRightOutputForInput(dir.symbol, step.symbol);
                else
                    Machine.SetWrongOutputForInput(dir.symbol, step.symbol);
            }
            while (!Machine.RightOutputExistsForInput(dir.symbol));//пока не подобрано верное соответствие

            Interface.RefreshList(dir.name + " (" + dir.symbol + ')' , step.name + " (" + step.symbol + ')');
        }
Esempio n. 3
0
 void AttemptMove(Direction dir)
 {
     if (Machine.RightOutputExistsForInput(dir.symbol))
         rob.MakeStep((Action)Machine.GetRightOutputForInput(dir.symbol), normalDelay);
     else
         LearnToMove(dir);
 }