Esempio n. 1
0
        private void Program_Indicator_Tick(object sender, EventArgs e)
        {
            if (heuristics.get_TimerController() == true)
            {
                if (useUI)
                {
                    UI_Drawer_Int("현재높이", heuristics.get_Height(), label_Height);

                    UI_Drawer_Int("빈공간", heuristics.get_Empty_Space(), label_Empty);
                }


                /*블록 평가 */
                heuristics.set_Matrix(mapping.get_Matrix());
                heuristics.Evaluate_Block_Relevance(Current_Block, mapping.get_Matrix());

                label_Adjacent.Text = null;
                /*UI 부분 업로드*/
                if (useUI)
                {
                    for (int j = 0; j < heuristics.get_Under_Blocks().Length / 12; j++)
                    {
                        label_Adjacent.Text = label_Adjacent.Text + "밀착 공간(아래, 회전수" + j + ")";
                        for (int i = 0; i < width / Interval; i++)
                        {
                            label_Adjacent.Text = label_Adjacent.Text + " " + heuristics.get_Under_Blocks()[j, i];
                        }
                        label_Adjacent.Text = label_Adjacent.Text + "\n";
                    }
                    try
                    {
                        UI_Drawer("평균높이", heuristics.get_Average_Height(), label_AverageHeight, true);
                        UI_Drawer("미래 평균높이", heuristics.get_Heuristics_Height(), label_FutureHeight, true);


                        /*UI 부분 업로드*/
                        label_H_Difference.Text = "평균 높이차";
                        for (int i = 0; i < width / Interval; i++)
                        {
                            label_H_Difference.Text = label_H_Difference.Text + " " + (heuristics.get_Heuristics_Height()[i] - heuristics.get_Average_Height()[i]);
                        }
                    }
                    catch (NullReferenceException E)
                    {
                        Console.WriteLine(E.Message);
                    }
                }


                trial = true;
                heuristics.set_TimerController(false);
            }
            if (trial == false)
            {
                return;
            }
            AI_Manuplate();
        }
Esempio n. 2
0
        public bool TimePass(char Color)
        {
            bool isPass = false;

            if (flow != true)
            {
                for (int i = 0; i < 4; i++)
                {
                    if (character[i, 0] < numHeight - 1 && Matrix[character[i, 0] + 1, character[i, 1]] != CharacterColor && Matrix[character[i, 0] + 1, character[i, 1]] == empty)
                    {
                        isPass = true;
                    }
                    else if (character[i, 0] < numHeight - 1 && Matrix[character[i, 0] + 1, character[i, 1]] == CharacterColor)
                    {
                        isPass = true;
                    }
                    else
                    {
                        isPass = false;
                        break;
                    }
                }
                if (isPass == true)
                {
                    if (!Repaint(empty))
                    {
                        return(false);//Map이 변경되지 않음.
                    }
                    user[1]++;
                    character = form.Block_Rotate(Figure, user[0], user[1], Rotation);
                    Repaint(CharacterColor);
                    Drawed = true;//Map 이 변경되었음.
                }
                else
                {
                    heuristics.set_Matrix(Matrix);
                    Create(Color);
                    Height_Detector();
                    Block_Remover();
                    flow = true;
                }
            }
            return(flow);
        }