示例#1
0
        private void Tetris_Map_Load(object sender, EventArgs e)
        {
            /*맵 그리기*/
            Map.Width     = width;
            Map.Height    = height;
            graphics      = Map.CreateGraphics();
            figure        = new Figure(Map, width / Interval, height / Interval);
            Map.BackColor = Color.White;

            /* 유전 알고리즘 삽입 */
            Learning = new Genetic();

            /*AI_객체 생성*/
            try
            {
                Calculator = new CalculationNetwork(Learning.get_Formula(), Learning.Load_Recent_Gene());
            }
            catch (Exception ex)
            {
                Calculator = new CalculationNetwork(Learning.get_Formula());
                Console.WriteLine(ex.Message);
            }
            heuristics = new Heuristics(width / Interval, height / Interval, Calculator);
            Generator  = new Random();

            /*테트리스 객체 생성*/
            mapping = new Mapping(heuristics, width / Interval, height / Interval);

            /*UI Initializer*/
            trial = false;
            useUI = false;
            UI_Clear();
            Genetic_UI_Drawer();
        }
示例#2
0
        public Heuristics(int numWidth, int numHeight, CalculationNetwork calculator)
        {
            form            = new Formator();
            Color_Form      = form.get_Color_Form();
            Figure_Form     = form.get_Figure_Form();
            Height_info     = new int[numWidth];
            BlockEmpty      = new int[numWidth];
            Under_Blocks    = new int[4, numWidth];
            Heuristic_Value = new double[numWidth];
            Side_Block      = new double[numWidth];

            Weight     = calculator.get_weight();
            Calculator = calculator;
            Width      = numWidth;
            Height     = numHeight;
        }
示例#3
0
        public void game_Start()
        {
            try
            {
                Calculator = new CalculationNetwork(Learning.get_Formula(), Learning.Load_Recent_Gene());
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            heuristics = new Heuristics(width / Interval, height / Interval, Calculator);
            mapping    = new Mapping(heuristics, width / Interval, height / Interval);

            heuristics.set_Weight(Learning.get_Weight());
            Next_Block    = Generator.Next(6);
            Current_Block = Generator.Next(6);
            BlockColor    = mapping.init_Character(Current_Block, 5);
        }