public void run() { Console.Title = "Лабораторная работа №2"; Console.Clear(); wall.Draw(); HorizontalLine h1 = new HorizontalLine(5, 14, 3, '═'); HorizontalLine h2 = new HorizontalLine(5, 14, 7, '═'); h1.Draw(); h2.Draw(); VerticalLine h3 = new VerticalLine(4, 7, 5, '*'); VerticalLine h4 = new VerticalLine(4, 7, 14, '*'); h3.Draw(); h4.Draw(); Console.ReadKey(); Program.Main(); }
public void line() { Console.Clear(); Console.SetWindowSize(x, y); wall.Draw(); string t = ""; Console.SetCursorPosition(2, y - 2); Console.Write("Введите координаты линии (через пробел):"); t = Console.ReadLine(); wall.clear(); string[] tv = t.Split(' ').Where(z => z != "").ToArray(); int AX = int.Parse(tv[0]); int AY = int.Parse(tv[1]); int AZ = int.Parse(tv[2]); HorizontalLine L1 = new HorizontalLine(AX, AY, AZ, '═'); t = ""; Console.SetCursorPosition(2, 41); Console.Write("вертикальная линия (через пробел) :"); t = Console.ReadLine(); tv = t.Split(' ').Where(z => z != "").ToArray(); AX = int.Parse(tv[0]); AY = int.Parse(tv[1]); AZ = int.Parse(tv[2]); VerticalLine L2 = new VerticalLine(AX, AY, AZ, '║'); wall.clear(); L1.Draw(); L2.Draw(); if (L1.IsHit(L2)) { Console.SetCursorPosition(2, y - 2); Console.Write("Линии пересекаются"); } else { Console.SetCursorPosition(2, y - 2); Console.Write("Линии не пересекаются"); } Console.ReadKey(); Program.Main(); }
public Walls(int mapWidth, int mapHeight) { wallList = new List <Figure>(); int x = 85, y = 43; // Отрисовка рамочки HorizontalLine upLine = new HorizontalLine(0, mapWidth - 2, 0, '═'); HorizontalLine downLine = new HorizontalLine(0, mapWidth - 2, mapHeight - 1, '═'); VerticalLine leftLine = new VerticalLine(0, mapHeight - 1, 0, '║'); VerticalLine rightLine = new VerticalLine(0, mapHeight - 1, mapWidth - 2, '║'); lucorner Lucorner = new lucorner(0, 0, '╔'); rucorner Rucorner = new rucorner(x - 2, 0, '╗'); ldcorner Ldcorner = new ldcorner(0, y - 1, '╚'); rdcorner Rdcorner = new rdcorner(x - 2, y - 1, '╝'); wallList.Add(upLine); wallList.Add(downLine); wallList.Add(leftLine); wallList.Add(rightLine); wallList.Add(Lucorner); wallList.Add(Rucorner); wallList.Add(Ldcorner); wallList.Add(Rdcorner); }