Exemple #1
0
        public static void PlayPongN()
        {
            SimpleNetVer Jeff = new SimpleNetVer(7, 1, -1, 2, 5, 20, 40, 100, 40, 3);

            Jeff.SetAfNames("t", "rtL", "rtL", "rtL", "s");
            Jeff.SetAfT(1, 1);
            Jeff.SetAfT(2, 0, 1, 2);
            Jeff.SetAfT(3, 0, 1, 2);
            Jeff.SetAfT(4, 0, 1, 2);
            Jeff.SetAfT(5, 1);


            //Q_Learning Jeffine = new Q_Learning(0.9, 0, 3, 0);



            Pong.DrawMap();
            Random rnd = new Random();

            while (true)
            {
                Jeff.SetInput(Pong.GetState1NN() /*.Concat(new double[] { rnd.NextDouble() * 10 - 5 }).ToArray()*/);
                Jeff.OutputBerechnen();

                //int act = Jeffine.Get_SetAction(Pong.GetState2(), Pong.punktePlayer2);


                Pong.punktePlayer1 = 0;
                Pong.punktePlayer2 = 0;


                Pong.Play(Jeff.GetMaxOutputIndex(), null);

                if (Pong.punktePlayer1 != 0)
                {
                    Jeff.LearnWithRegister(Pong.punktePlayer1, true, 0.9);
                    Jeff.lastInput = new List <double[]>();
                }


                //System.Threading.Thread.Sleep(20);
            }
        }