//odredi gdje ce se iduce pomaknut
        public void CalculateNextMove()
        {
            brainOutput = brain.ForwardPass(brainInput);

            int maxIdx = Array.IndexOf(brainOutput, brainOutput.Max());

            switch (maxIdx)
            {
            case 0:    //desno
                BaseVelocity.X = 1;
                BaseVelocity.Y = 0;
                break;

            case 1:    //gore
                BaseVelocity.X = 0;
                BaseVelocity.Y = 1;
                break;

            case 2:    //lijevo
                BaseVelocity.X = -1;
                BaseVelocity.Y = 0;
                break;

            default:    //dole
                BaseVelocity.X = 0;
                BaseVelocity.Y = -1;
                break;
                //promijeni odgovarajuce vrijednosti da se opterecujemo GC
            }
        }
示例#2
0
        //odredi gdje ce se iduce pomaknut
        public void CalculateNextMove()
        {
            brainOutput = brain.ForwardPass(brainInput);

            int maxIdx = Array.IndexOf(brainOutput, brainOutput.Max());

            switch (maxIdx)
            {
            case 0:    //desno
                BaseVelocity.X = 1;
                BaseVelocity.Y = 0;
                break;

            case 1:    //dole
                BaseVelocity.X = 0;
                BaseVelocity.Y = 1;
                break;

            case 2:    //lijevo
                BaseVelocity.X = -1;
                BaseVelocity.Y = 0;
                break;

            default:    //gore
                BaseVelocity.X = 0;
                BaseVelocity.Y = -1;
                break;
            }
        }