public void FindAdjacentDoesNotAllowNegativeStartingPoints() { var gen = new MineSweeperBoardGenerator(36, 6); var board = gen.GetBoard(); var helper = new MineSweeperBoardHelper(); var adjacentTileCount = helper.FindAdjacentTilePositions(board, -1, -1).Count(); if (adjacentTileCount != 0) { Assert.Fail(); } }
void SetAdjacentValues(int tileY, int tileX, ITile[,] boardTiles, Func <ITile, bool> condition) { var tileHelper = new MineSweeperBoardHelper(); var adjacentTiles = tileHelper.FindAdjacentTilePositions(boardTiles, tileY, tileX); int adjacentConditionCount = 0; foreach (var tile in adjacentTiles) { if (!condition(boardTiles[tile.Item1, tile.Item2])) { adjacentConditionCount++; } } boardTiles[tileY, tileX].AdjacentTileCount = adjacentConditionCount; }