Пример #1
0
        static void Main(string[] args)
        {
            var x = Console.WindowWidth;
            //Console.SetBufferSize(80, 25);

            HorizontalLine upLine = new HorizontalLine(0, 78, 0, '+');
            HorizontalLine downLine = new HorizontalLine(0, 78, 24, '+');
            VerticalLine leftLine = new VerticalLine(0, 24, 0, '+');
            VerticalLine rightLine = new VerticalLine(0, 24, 78, '+');

            upLine.DrawLine();
            downLine.DrawLine();
            leftLine.DrawLine();
            rightLine.DrawLine();

            Point p = new Point(4, 5, '*');
            Snake snake = new Snake(p, 4, Direction.RIGHT);
            snake.DrawLine();

            while (true)
            {
                if(Console.KeyAvailable)
                {
                    ConsoleKeyInfo key = Console.ReadKey();
                    snake.HandleKey(key.Key);

                }
                Thread.Sleep(100);
                snake.Move();
            }

            Console.ReadKey();
        }
Пример #2
0
        static void Main(string[] args)
        {
            var x = Console.WindowWidth;
            //Console.SetBufferSize(80, 25);


            HorizontalLine upLine    = new HorizontalLine(0, 78, 0, '+');
            HorizontalLine downLine  = new HorizontalLine(0, 78, 24, '+');
            VerticalLine   leftLine  = new VerticalLine(0, 24, 0, '+');
            VerticalLine   rightLine = new VerticalLine(0, 24, 78, '+');

            upLine.DrawLine();
            downLine.DrawLine();
            leftLine.DrawLine();
            rightLine.DrawLine();

            Point p     = new Point(4, 5, '*');
            Snake snake = new Snake(p, 4, Direction.RIGHT);

            snake.DrawLine();

            while (true)
            {
                if (Console.KeyAvailable)
                {
                    ConsoleKeyInfo key = Console.ReadKey();
                    snake.HandleKey(key.Key);
                }
                Thread.Sleep(100);
                snake.Move();
            }


            Console.ReadKey();
        }
Пример #3
0
        static void Main(string[] args)
        {
            Console.SetBufferSize(80, 26);
            HorizontalLine upperLine = new HorizontalLine(0, 78, 0, '+');
            HorizontalLine downLine  = new HorizontalLine(0, 78, 24, '+');
            VerticalLine   leftLine  = new VerticalLine(0, 0, 24, '+');
            VerticalLine   rightLine = new VerticalLine(78, 0, 24, '+');

            upperLine.DrawLine();
            downLine.DrawLine();
            leftLine.DrawLine();
            rightLine.DrawLine();

            Point p     = new Point(5, 4, '*');
            Snake snake = new Snake(p, 4, Direction.RIGHT);

            snake.DrawLine();
            snake.Move();
            Thread.Sleep(300);
            snake.Move();
            Thread.Sleep(300);
            snake.Move();
            Thread.Sleep(300);
            snake.Move();
            Thread.Sleep(300);
            snake.Move();
            Thread.Sleep(300);
            snake.Move();
            Thread.Sleep(300);
            snake.Move();

            Console.ReadLine();
        }
Пример #4
0
        static void Main(string[] args)
        {
            //Point p1 = new Point(1, 2, '!');
            //Point p2 = new Point(3, 4, '@');
            //Point p3 = new Point(5, 6, '#');
            //Point p4 = new Point(7, 8, '$');
            //List<Point> plist = new List<Point>();
            //plist.Add(p1);
            //plist.Add(p2);
            //plist.Add(p3);
            //plist.Add(p4);
            HorizontalLine line1 = new HorizontalLine(0, 10, 0, '*');

            line1.DrawLine();
            VerticalLine line2 = new VerticalLine(0, 10, 0, '*');

            line2.DrawLine();
            Console.ReadKey();
        }
Пример #5
0
        static void Main(string[] args)
        {
            Console.SetWindowSize(80, 25);
            HorizontalLine upLine    = new HorizontalLine(0, 78, 0, '+');
            HorizontalLine downLine  = new HorizontalLine(0, 78, 24, '+');
            VerticalLine   leftLine  = new VerticalLine(0, 0, 24, '+');
            VerticalLine   rightLine = new VerticalLine(78, 0, 24, '+');

            upLine.DrawLine();
            downLine.DrawLine();
            leftLine.DrawLine();
            rightLine.DrawLine();
            Point p1 = new Point(3, 3, '*');

            p1.DrawPoint();


            Console.ReadLine();
        }