private Cell[] GetCellsBlockPath() => new Cell[3] { new Cell(1, 0, RandomBall.GetRand()), new Cell(1, 1, RandomBall.GetRand()), new Cell(0, 1, RandomBall.GetRand()) };
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)); }
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)); }
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; } } } }