예제 #1
0
        public void PrepareBoard(int boardSizeX, int boardSizeY)
        {
            Console.CursorVisible = false;
            BoardSizeX            = boardSizeX;
            BoardSizeY            = boardSizeY;
            Point upperLeftCorner = new Point(0, 0, '+');

            corneres.Add(upperLeftCorner);
            Point upperRightCorner = new Point(BoardSizeX + 1, 0, '+');

            corneres.Add(upperRightCorner);
            Point lowerLeftCorner = new Point(0, boardSizeY + 1, '+');

            corneres.Add(lowerLeftCorner);
            Point lowerRightCorner = new Point(boardSizeX + 1, boardSizeY + 1, '+');

            corneres.Add(lowerRightCorner);
            upper = new HorizontalLine(1, boardSizeX, 0, '-');
            borders.Add(upper);
            lower = new HorizontalLine(1, boardSizeX, boardSizeY + 1, '-');
            borders.Add(lower);
            left = new VerticalLine(1, boardSizeY, 0, '|');
            borders.Add(left);
            right = new VerticalLine(1, boardSizeY, boardSizeX + 1, '|');
            borders.Add(right);

            drawAll += DrawBoard;
            drawAll += CheckIfHitWithWalls;
            drawAll += DrawHero;
            drawAll += DrawMines;
        }
예제 #2
0
        public void DrawVerticalLine(IBoard board)
        {
            VerticalLine vLineToDraw = new VerticalLine(1, board.BoardSizeY, board.BoardSizeX / 2, '|');

            foreach (Point p in vLineToDraw.pList)
            {
                boardContent.Add(p);
            }
        }
예제 #3
0
        public BoardWithListOfPoints(int boardSizeX, int boardSizeY)
        {
            BoardSizeX = boardSizeX;
            BoardSizeY = boardSizeY;
            Point upperLeftCorner = new Point(0, 0, '+');

            board.Add(upperLeftCorner);
            Point upperRightCorner = new Point(BoardSizeX + 1, 0, '+');

            board.Add(upperRightCorner);
            Point lowerLeftCorner = new Point(0, boardSizeY + 1, '+');

            board.Add(lowerLeftCorner);
            Point lowerRightCorner = new Point(boardSizeX + 1, boardSizeY + 1, '+');

            board.Add(lowerRightCorner);
            HorizontalLine upperLine = new HorizontalLine(1, boardSizeX, 0, '-');

            foreach (Point p in upperLine.pList)
            {
                board.Add(p);
            }
            HorizontalLine lowerLine = new HorizontalLine(1, boardSizeX, boardSizeY + 1, '-');

            foreach (Point p in lowerLine.pList)
            {
                board.Add(p);
            }
            VerticalLine leftLine = new VerticalLine(1, boardSizeY, 0, '|');

            foreach (Point p in leftLine.pList)
            {
                board.Add(p);
            }
            VerticalLine rightLine = new VerticalLine(1, boardSizeY, boardSizeX + 1, '|');

            foreach (Point p in rightLine.pList)
            {
                board.Add(p);
            }
        }