static void Main(string[] args) { //Console.SetWindowSize(40, 16); //for (int x = 0; x < 5; x++) //{ // for (int y = 0; y < 10; y++) // { // var p3 = new Point(x, y, '#'); // p3.Draw(); // } //} //List<Point> pList = new List<Point>(); //pList.Add(new Point(10, 10, 'c')); //pList.Add(new Point(11, 10, 'c')); //pList.Add(new Point(3, 10, 'c')); //pList.Add(new Point(10, 2, 'c')); //pList.Add(new Point(7, 10, 'c')); //foreach (var p in pList) //{ // p.Draw(); //} HorizontalLine hLine = new HorizontalLine(0, 0, 36, '#'); HorizontalLine hLine2 = new HorizontalLine(0, 20, 36, '#'); hLine.Draw(); hLine2.Draw(); VerticalLine vLine = new VerticalLine(0, 0, 21, '#'); VerticalLine vLine2 = new VerticalLine(36, 0, 21, '#'); vLine.Draw(); vLine2.Draw(); Random rand = new Random(); Point p = new Point(5, rand.Next(2, 10), '*'); p.Draw(); while (true) { Thread.Sleep(300); p.Move(Direction.Down); } Console.ReadLine(); }
static void Main(string[] args) { HorizontalLine h1 = new HorizontalLine(1, 25, 1, '#'); h1.Draw(); HorizontalLine h2 = new HorizontalLine(1, 25, 30, '#'); h2.Draw(); VerticalLine v1 = new VerticalLine(1, 30, 1, '#'); v1.Draw(); VerticalLine v2 = new VerticalLine(1, 30, 25, '#'); v2.Draw(); Console.ReadKey(); }
static void Main(string[] args) { Console.SetBufferSize(80, 25); HorizontallLine upLine = new HorizontallLine(0, 78, 0, '+'); HorizontallLine downLine = new HorizontallLine(0, 78, 24, '+'); VerticalLine leftLine = new VerticalLine(0, 24, 0, '+'); VerticalLine rightLine = new VerticalLine(0, 24, 78, '+'); upLine.Draw(); downLine.Draw(); leftLine.Draw(); rightLine.Draw(); Point p = new Point(4, 5, '*'); Snake snake = new Snake(p, 4, Direction.RIGTH); snake.Draw(); Console.ReadLine(); }
public override void Start() { var p1 = new Point(0, 0); var p2 = new Point(p1); p1.Draw(); Console.WriteLine(); Console.WriteLine("Point p1 = new Point(0,0);"); Console.WriteLine("Point p2 = new Point(p1);"); Console.WriteLine("IsHit(p1,p2): {0}", Point.IsHit(p1, p2)); Console.WriteLine("p1.IsHit(p2): {0}", p1.IsHit(p2)); Console.WriteLine("p2.IsHit(p1): {0}", p2.IsHit(p1)); Console.WriteLine("Equals(p1,p2): {0}", Equals(p1, p2)); p2.Y = p1.Y = 10; p2.X = 1; p2.Char = '#'; Console.WriteLine("p2.Y = p1.Y = 10;"); Console.WriteLine("p2.X = 1;"); Console.WriteLine("p2.Char = '#';"); p1.Draw(); p2.Draw(); Console.WriteLine(); Console.WriteLine("IsHit(p1,p2): {0}", Point.IsHit(p1, p2)); Console.WriteLine("p1.IsHit(p2): {0}", p1.IsHit(p2)); Console.WriteLine("p2.IsHit(p1): {0}", p2.IsHit(p1)); Console.WriteLine(); var f1 = new VerticalLine(20, 24, 2, '*'); var f2 = new HorizontalLine(0, 4, 22, '*'); Console.SetCursorPosition(0, 25); Console.WriteLine("Figure f1 = new VerticalLine(20, 24, 2, '*');"); Console.WriteLine("Figure f2 = new HorizontalLine(0, 4, 22, '*');"); Console.WriteLine("IsHit(f1, f2): {0}", Figure.IsHit(f1, f2)); Console.WriteLine("f1.IsHit(f2): {0}", f1.IsHit(f2)); Console.WriteLine("f2.IsHit(f1): {0}", f2.IsHit(f1)); f1.Draw(); f2.Draw(); Console.ReadKey(); }