Beispiel #1
0
 private void GetInputReady(MapAPC map, MapAPCBig mapBig)
 {
     SetMeasureChanges(map, mapBig);
     SetRightNormOfTheVector();
     SetCoeficientsOfLine();
     SetSignOfLineOfInequality();
     BFSForApcMap();
     SetInput(map);
 }
Beispiel #2
0
        private void SetMeasureChanges(MapAPC map, MapAPCBig mapBig)
        {
            int a, b;

            map.GetSectorCoordinantes(out a, out b, this.GetPosition());
            positionAPC.x = a;
            positionAPC.y = b;
            mapBig.GetSectorCoordinantes(out a, out b, this.GetPosition());
            positionAPCBig.x = a;
            positionAPCBig.y = b;
        }
Beispiel #3
0
 private static void SetMapAPC()
 {
     mapApc    = new MapAPC(f.Height, f.Width);
     mapApcBig = new MapAPCBig(f.Height, f.Width);
 }
Beispiel #4
0
        private void FindNextStepAI()
        {
            MapAPC    map    = WindowOfGame.GetApcMap();
            MapAPCBig mapBig = WindowOfGame.GetApcMapBig();

            GetInputReady(map, mapBig);
            so.SetSoftmaxOutput(neurons[0].W.Length, neurons);

            /*
             * pouze pokud chci trenovat neurnovou sit:
             * TrainingCounter++;
             * if (TrainingCounter%5 == 0)
             * {
             *  TrainWs(so.GetDeltaWs());
             * }*/

            if (!CanIGoThereRunning)
            {
                CanIGoThereRunning = true;
                WindowOfGame.Log("FindNextStepAI, can i go there?");

                if (!CanIGoThere())
                {
                    WindowOfGame.Log("FindNextStepAI, i cant go there");
                    if (!CanIGoToRight())
                    {
                        TurningState = 1;
                    }
                    else
                    {
                        TurningState = -1;
                    }
                    TurningCounter = 10;
                }
                else
                {
                    switch (so.GetTheHighestOutput())
                    {
                    case 0:     //nonturning, puvodne "hodne doleva"
                        TurningState   = 0;
                        TurningCounter = 5;
                        break;

                    case 1:    //nonturning, puvodne "stredne doleva"
                        TurningState   = 0;
                        TurningCounter = 5;
                        break;

                    case 2:    //short left
                        TurningState   = -1;
                        TurningCounter = 4;
                        break;

                    case 3:    //nonturning
                        TurningState   = 0;
                        TurningCounter = 5;
                        break;

                    case 4:    //short right
                        TurningState   = 1;
                        TurningCounter = 4;
                        break;

                    case 5:    //nonturning, puvodne "stredne doprava"
                        TurningState   = 0;
                        TurningCounter = 5;
                        break;

                    case 6:    //nonturning, puvodne "hodne doprava"
                        TurningState   = 0;
                        TurningCounter = 5;
                        break;
                    }
                }
            }
            recalculationRunning = false;
            CanIGoThereRunning   = false;
        }