Пример #1
0
 private void GetInputReady(MapAPC map, MapAPCBig mapBig)
 {
     SetMeasureChanges(map, mapBig);
     SetRightNormOfTheVector();
     SetCoeficientsOfLine();
     SetSignOfLineOfInequality();
     BFSForApcMap();
     SetInput(map);
 }
Пример #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;
        }
Пример #3
0
 private void SetInput(MapAPC map)
 {
     int[] field;
     if (L_input.Count > R_input.Count)
     {
         for (int i = 0; i < neurons.Length / 2; i++)
         {
             field            = L_input.Dequeue();
             neurons[2 * i].x = map.GetFieldValue(field[0], field[1]);
         }
         int j = 0;
         while (R_input.Count > 0)
         {
             field = R_input.Dequeue();
             neurons[2 * j + 1].x = map.GetFieldValue(field[0], field[1]);
             j++;
         }
         while (L_input.Count > 0)
         {
             field = L_input.Dequeue();
             neurons[2 * j + 1].x = map.GetFieldValue(field[0], field[1]);
             j++;
         }
     }
     else
     {
         for (int i = 0; i < neurons.Length / 2; i++)
         {
             field = R_input.Dequeue();
             neurons[2 * i + 1].x = map.GetFieldValue(field[0], field[1]);
         }
         int j = 0;
         while (L_input.Count > 0)
         {
             field            = L_input.Dequeue();
             neurons[2 * j].x = map.GetFieldValue(field[0], field[1]);
             j++;
         }
         while (R_input.Count > 0)
         {
             field            = R_input.Dequeue();
             neurons[2 * j].x = map.GetFieldValue(field[0], field[1]);
             j++;
         }
     }
 }
Пример #4
0
 public WindowOfResults(Player[] playersF, Game hra2, WindowOfPlayerSettings wops2, MapAPC mapApc)
 {
     InitializeComponent();
     playersForm = playersF;
     hra         = hra2;
     wops        = wops2;
     CreateRP();
     SortResults();
 }
Пример #5
0
 private static void SetMapAPC()
 {
     mapApc    = new MapAPC(f.Height, f.Width);
     mapApcBig = new MapAPCBig(f.Height, f.Width);
 }
Пример #6
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;
        }