Пример #1
0
        static void Main(string[] args)
        {
            /*Point p1 = new Point(1, 3, '*');
             * p1.x = 1;
             * p1.y = 3;
             * p1.sym = '*';
             * p1.draw();
             * int x1 = 1;
             * int y1 = 3;
             * char sym1 = '*';
             * draw(x1, y1, sym1);*/
            /*Point p2 = new Point(4, 5, '#');
             * p2.x = 4;
             * p2.y = 5;
             * p2.sym = '#';
             * p2.draw();
             * int x2 = 4;
             * int y2 = 5;
             * char sym2 = '#';
             * draw(x2, y2, sym2);
             * List<int> numlist = new List<int>();
             * numlist.Add(0);
             * numlist.Add(1);
             * numlist.Add(2);
             * int x = numlist[0];
             * int y = numlist[1];
             * int z = numlist[2];
             * foreach(int i in numlist)
             * {
             *  Console.WriteLine(i);
             * }
             * numlist.RemoveAt(0);
             * List<Point> plist = new List<Point>();
             * plist.Add(p1);
             * plist.Add(p2);*/
            //Отрисовка рамочки
            Console.SetBufferSize(80, 25);
            Horizontalline upline    = new Horizontalline(0, 78, 0, '+');
            Horizontalline downline  = new Horizontalline(0, 78, 24, '+');
            Vertikalline   leftline  = new Vertikalline(0, 24, 0, '+');
            Vertikalline   rightline = new Vertikalline(0, 24, 78, '+');

            upline.draw();
            downline.draw();
            leftline.draw();
            rightline.draw();
            //Отрисовка точек
            Point p = new Point(4, 5, '*');
            /*p.draw();*/
            Snake1 snake = new Snake1(p, 4, Direction.right);

            snake.draw();
            Console.ReadLine();
        }
Пример #2
0
        public Walls(int mapWidth, int mapHeight)
        {
            wallList = new List <Figure>();

            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, '+');

            wallList.Add(upLine);
            wallList.Add(downLine);
            wallList.Add(leftLine);
            wallList.Add(rightLine);
        }
Пример #3
0
        static void Main(string[] args)
        {
            Console.SetWindowSize(1, 1);
            Console.SetBufferSize(80, 25);
            Console.SetWindowSize(80, 25);

            Point lefttop     = new Point(0, 0, ' ');
            Point rightbottom = new Point(79, 23, ' ');

            // Рисуем рамочку
            char           sym        = '+';
            Horizontalline topline    = new Horizontalline(lefttop.x, rightbottom.x, lefttop.y, sym);
            Horizontalline bottomline = new Horizontalline(lefttop.x, rightbottom.x, rightbottom.y, sym);
            Verticalline   leftline   = new Verticalline(lefttop.x, lefttop.y++, rightbottom.y--, sym);
            Verticalline   rightline  = new Verticalline(rightbottom.x, lefttop.y++, rightbottom.y--, sym);

            topline.Draw();
            bottomline.Draw();
            leftline.Draw();
            rightline.Draw();

            Point p     = new Point(3, 5, '█');
            Snake snake = new Snake(p, 10, Direction.RIGHT);

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

            Console.ReadLine();
        }
Пример #4
0
        static void Main( string[] args )
        {
            Console.SetWindowSize(1, 1);
            Console.SetBufferSize(80, 25);
            Console.SetWindowSize(80, 25);

            Point lefttop = new Point(0, 0, ' ');
            Point rightbottom = new Point(79, 23, ' ');

            // Рисуем рамочку
            char sym = '+';
            Horizontalline topline = new Horizontalline(lefttop.x, rightbottom.x, lefttop.y, sym);
            Horizontalline bottomline = new Horizontalline(lefttop.x, rightbottom.x, rightbottom.y, sym);
            Verticalline leftline = new Verticalline(lefttop.x, lefttop.y++, rightbottom.y--, sym);
            Verticalline rightline = new Verticalline(rightbottom.x, lefttop.y++, rightbottom.y--, sym);
            topline.Draw();
            bottomline.Draw();
            leftline.Draw();
            rightline.Draw();

            Point p = new Point(3, 5, '█');
            Snake snake = new Snake(p, 10, Direction.RIGHT);

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

            Console.ReadLine();
        }