Ejemplo n.º 1
0
 private Cell[] GetCellsBlockPath() =>
 new Cell[3]
 {
     new Cell(1, 0, RandomBall.GetRand()),
     new Cell(1, 1, RandomBall.GetRand()),
     new Cell(0, 1, RandomBall.GetRand())
 };
Ejemplo n.º 2
0
        public void PathExist()
        {
            Cell startCellWithBall = new Cell(0, 0, RandomBall.GetRand());
            Cell tergetEmptyCell   = new Cell(_defBoardSize - 1, _defBoardSize - 1);

            _board.AddBallToCell(startCellWithBall);

            Assert.IsTrue(_board.IsPathExist(startCellWithBall, tergetEmptyCell));
        }
Ejemplo n.º 3
0
        public void PathNotExist()
        {
            Cell startCellWithBall = new Cell(0, 0, RandomBall.GetRand());
            Cell tergetEmptyCell   = new Cell(_defBoardSize - 1, _defBoardSize - 1);

            Cell[] cellsBlockingPath = GetCellsBlockPath();

            _board.AddBallToCell(startCellWithBall);
            _board.AddBallToCell(cellsBlockingPath);

            Assert.IsFalse(_board.IsPathExist(startCellWithBall, tergetEmptyCell));
        }
Ejemplo n.º 4
0
        private void AddBallsToBoardCells(int countBalls)
        {
            int counter = 0;

            for (int row = 0; row < _defBoardSize; row++)
            {
                for (int col = 0; col < _defBoardSize; col++)
                {
                    _board[row][col].Ball = RandomBall.GetRand();

                    if (++counter == countBalls)
                    {
                        return;
                    }
                }
            }
        }