Esempio n. 1
0
        public static void Jeff()
        {
            Random      rnd  = new Random();
            NeuronalNet Jeff = new NeuronalNet(0, 209, 200, 100, 5);

            Jeff.StandartInitialisierung();
            Tetris.MapAktualisieren(true);
            bool nochmal = true;

            while (nochmal)
            {
                Tetris.MapAktualisieren(true);
                while (Tetris.leben)
                {
                    Jeff.InputGeben(Tetris.GetV());
                    Jeff.AllesBerechnen();
                    double[] b = Tetris.UserBewegung(Console.ReadKey().KeyChar);
                    Jeff.DeepLearning(b);
                }
                Tetris.AllesReset();
                Console.Clear();
                Console.Write("Nochmal");
                string text = Console.ReadLine();

                if (text == "nein" || text == "n")
                {
                    nochmal = false;
                }
            }
            Console.Clear();

            while (true)
            {
                Console.Clear();
                Tetris.MapAktualisieren(true);


                while (Tetris.leben && !Tetris.kiTutNichts && Tetris.sinnloseBewegung < 350)
                {
                    Console.SetCursorPosition(0, 0);
                    ArrayAusgeben(Jeff.GetOutput());
                    Jeff.InputGeben(Tetris.GetV());
                    Jeff.AllesBerechnen();


                    Tetris.BewegungShow(Jeff.GetOutput(), 0.5);
                }


                Tetris.AllesReset();
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Connection  y = new Connection(new NeuronPosition(0, 0));
            KuhleKlasse x = new KuhleKlasse();

            Console.WriteLine(GetLength(y));



            Console.ReadLine();
            Programme.PlayPongN();
            Pong.DrawMap();

            while (true)
            {
                Console.SetCursorPosition(0, 0);
                char c = Console.ReadKey().KeyChar;
                if (c == 'w')
                {
                    Pong.Play(0, 0);
                }
                else if (c == 's')
                {
                    Pong.Play(1, 0);
                }
            }

            Console.ReadLine();
            Tetris.TetrisSetup();
            Tetris.MapAktualisieren(true);
            while (true)
            {
                Tetris.UserBewegung(Console.ReadKey().KeyChar);
            }
            int a = 6;
            int b = 2;

            Console.WriteLine(Convert.ToInt32(Math.Round(Convert.ToDouble(a) / Convert.ToDouble(b), MidpointRounding.AwayFromZero)));

            double[,] arr = new double[5, 5] {
                { 0, 1, 2, 3, 4 }, { 5, 6, 7, 8, 9 }, { 10, 11, 12, 13, 14 }, { 15, 16, 17, 18, 19 }, { 20, 21, 22, 23, 24 }
            };
            double[,] arr2 = CNN2D.GetPice(arr, 1, 1, 5, 5);
            CNN2D.InsertValue(arr, 1, 1, 2, 2, 30);

            Console.ReadLine();
        }
Esempio n. 3
0
        public static void Q_Learning_Tetris()
        {
            int        lauf = 0;
            Q_Learning Q    = new Q_Learning(0.9, 0.2, 5, 3);

            while (true)
            {
                Tetris.TetrisSetup();
                Tetris.MapAktualisieren(true);

                while (Tetris.leben)
                {
                    double[] b = new double[5];
                    //Tetris.CheckLocher(18);
                    if (Tetris.punkte <= -300)
                    {
                        Tetris.leben = false;
                    }

                    Tetris.GetPunkteFurFastFolleReihe(5, 19, 18);
                    b[Q.Get_SetAction(Tetris.GetReihe(19, 18), Tetris.punkte)] = 1;
                    Console.SetCursorPosition(0, 0);
                    Console.WriteLine("Punkte: {0}", Tetris.punkte);


                    Tetris.punkte = 0;
                    Tetris.BewegungShow(b, 0.5);
                    System.Threading.Thread.Sleep(15);
                }
                Q.Get_SetAction(Tetris.GetReihe(19, 18), -500);
                Tetris.AllesReset();
                Console.Clear();
                ++lauf;

                //if(lauf%100==0)
                //    Serialize(Q, @"C:\Users\Gregor\Ki\Q_LearningTable_1.bin");
            }
        }