Пример #1
0
 public struct_open_cell(int x, int y, int z, int g, int h, int f, Ppoint parent)
 {
     point       = new Ppoint(x, y, z);
     G           = g;
     H           = h;
     F           = f;
     parent_cell = parent;
 }
Пример #2
0
        //Метод який молює шлях назад отримуючи масив з точок типу Ppoint
        public void draw_way(Stack <Ppoint> points)
        {
            SolidBrush yellow_br      = new SolidBrush(Color.Yellow);
            Pen        yellow_pen     = new Pen(yellow_br);
            Ppoint     previous_point = points.Peek();

            while (points.Count != 0)
            {
                Ppoint    temp = points.Pop();
                int       x    = temp.x * draw_copy.CellSize + draw_copy.CellSize / 4;
                int       y    = temp.y * draw_copy.CellSize + draw_copy.CellSize / 4;
                Rectangle rect = new Rectangle(x, y, draw_copy.CellSize / 2, draw_copy.CellSize / 2);

                elemnt_draw.FillEllipse(yellow_br, rect);

                elemnt_draw.DrawLine(yellow_pen, previous_point.x * draw_copy.CellSize + draw_copy.CellSize / 2,
                                     previous_point.y * draw_copy.CellSize + draw_copy.CellSize / 2,
                                     temp.x * draw_copy.CellSize + draw_copy.CellSize / 2,
                                     temp.y * draw_copy.CellSize + draw_copy.CellSize / 2);
                previous_point = temp;
            }
        }
Пример #3
0
 public struct_open_cell(int x, int y, int z, int h, Ppoint parent)
 {
     point       = new Ppoint(x, y, z);
     H           = h;
     parent_cell = parent;
 }
Пример #4
0
 public neibours(Ppoint pt, char sidet)
 {
     p    = pt;
     side = sidet;
 }
Пример #5
0
        public override void create_Labyrithm()
        {
            init_mas();
            draw_copy.Step = 2;
            Random rand = new Random();

            temp = new Ppoint(1, 1, Drowing.Absol_Coord(1, 1, draw_copy.NColumnX));
            neibours nt;
            int      _y = 0, _x = 0, _z = 0;

            draw_copy.Processed_cells[Drowing.Absol_Coord(1, 1, draw_copy.NColumnX)] = draw_copy.Step;
            chain_cells.Push(temp);
            draw_copy.Check_point = temp;
            form1.visualisation_mode(mode, form1, 1);

            while (chain_cells.Count != 0)//початок генерації
            {
                Mode = form1.Flag_radioButtons;
                temp = chain_cells.Peek();
                draw_copy.Check_point = temp;
                neibor.Clear();
                foreach (char tem in Mas_OF_sides)
                {
                    check_neibours(temp.x, temp.y, tem);
                }
                if (neibor.Count == 0)
                {
                    chain_cells.Pop();
                    form1.visualisation_mode(mode, form1);
                    continue;
                }
                nt = neibor[rand.Next(0, neibor.Count)];//обриаємо випадкову сторону сере доступних
                switch (nt.side)
                {
                case 'U':
                    _y = temp.y - 1;
                    _x = temp.x;
                    break;

                case 'D':
                    _y = temp.y + 1;
                    _x = temp.x;
                    break;

                case 'L':
                    _y = temp.y;
                    _x = temp.x - 1;
                    break;

                case 'R':
                    _y = temp.y;
                    _x = temp.x + 1;
                    break;
                }
                _z = Drowing.Absol_Coord(_y, _x, draw_copy.NColumnX);
                draw_copy.Map[_z]                 = false;//прорубуємо стінку
                draw_copy.Processed_cells[_z]     = draw_copy.Step - 1;
                draw_copy.Processed_cells[nt.p.z] = draw_copy.Step;

                form1.visualisation_mode(mode, form1, 1);
                chain_cells.Push(nt.p);
                draw_copy.Step++;
            }
            Reset_values();
        }
Пример #6
0
 public rect_point(int p1x, int p1y, int p2x, int p2y)
 {
     P1 = new Ppoint(p1x, p1y, 0);
     P2 = new Ppoint(p2x, p2y, 0);
 }
Пример #7
0
 public min_way(int x, int y, int z, int nstep)
 {
     point = new Ppoint(x, y, z);
     step  = nstep;
 }