Exemple #1
0
 public void bot_init(weights w = null, int nextcnt = 3)
 {
     init();
     if (w == null)
     {
         bot = new Juraknifecore();
     }
     else
     {
         bot = new Juraknifecore(w);
     }
     //Minorule = new mino_gene();
     bot.init();
     for (int i = 0; i < nextcnt; ++i)
     {
         int next = Minorule.genebag7int();
         bot.add_next(next);
         Board.add_next_piece(next);
     }
     bot.extend_node();
 }
Exemple #2
0
        public void Gamestart()
        {
            init();
            int atk = 0;

            for (int i = 0; i < 5; ++i)
            {
                F.add_next_piece(Minorule.genebag7int());
            }
            while (!F.isdead)
            {
                //F.add_garbage(2);
                F.add_next_piece(Minorule.genebag7int());
                F.Spawn_piece();
                //b.setpos(18, 3);
                //F.console_print(true, F.piece);
                //F.piece = b;

                while (!F.piece.locked)
                {
                    Console.Clear();

                    F.console_print(true, F.piece);
                    if (F.holdpiece != null)
                    {
                        F.holdpiece.console_print();
                    }
                    Console.Write(atk);
                    atk = 0;
                    if (F.piece.Tspin)
                    {
                        Console.WriteLine("tspin");
                        //if (F.piece.mini && row == 1)
                        //    Console.WriteLine("mini");
                    }

                    char a = Console.ReadKey().KeyChar;

                    switch (a)
                    {
                    case 'a':
                        F.piece.left_move(ref F);
                        break;

                    case 'd':
                        F.piece.right_move(ref F);
                        break;

                    case 's':
                        F.piece.soft_drop(ref F);
                        break;

                    case 'w':
                        //F.piece.mino_lock(ref F);
                        atk = lock_piece_calc();
                        //F.add_garbage(1);
                        break;

                    case 'l':
                        F.piece.right_rotation(ref F);

                        break;

                    case 'k':
                        F.piece.left_rotation(ref F);
                        break;

                    case 'j':

                        F.use_hold();
                        break;

                    default:
                        break;
                    }
                }
            }
        }